ActionScript 2.0 :: Condense The Script So Every Single Button?
Aug 18, 2009
I have a small Flash presentation I'm putting together and I've written out the code that I'll need or how it will function at least.My question is... is there an easy way to condense the script so every single button doesn't have like 20 if/elseif statements? This is the code on my main frame:
Code:
import mx.transitions.Tween; //import tweening class
import mx.transitions.easing.*;[code].....
Now I have to apply this idea to like 50 buttons in different sections. Is there a way that I can just check whats in that container already and then just load that movie out without all the code? I'm going to have to rewrite this thing like 50 times for it to work otherwise.
View 1 Replies
Similar Posts:
Jun 21, 2010
I want to condense the "var r1:Graphics = rec.graphics;" and all th relative variables into an array..Whats the most effective way to do this?
Code:
// rectangles, elbows, circles
var rec:Sprite = new Sprite();
var r1:Graphics = rec.graphics;
var r2:Graphics = rec.graphics;
[code]....
View 9 Replies
Nov 4, 2010
My XML has white space between every line so i used txt.condenseWhite=true; which worked well except now the paragraphs have no white space how can i get rid of the white space between lines and conserve the paragraph white space?
View 2 Replies
Sep 28, 2009
I'm extremely new to Flash and I am making a website and want to have a single button that when pressed pauses or plays a music file. I was able to create one that works by following a tutorial that I found online but the problem is that the button is on the main timeline so as I move away from it, it stops working. I think that it would work better if I was able to make a movie clip out of the button so that it doesn't sit on the main timeline and will keep working no matter where I am on the timeline. All I need is one button that pauses and plays music when pressed. I also want to be able to have a "music on" line of text and "music off" line of text depending on whether the music is playing or not.
View 4 Replies
Feb 5, 2011
I'm trying to create a button that, when first clicked, will add a MC to the stage. Then, on the second and subsequent clicks will remove the existing MC and replace it with a new one. The code I'm using is:
stop();
draw1.buttonMode = true;
draw1.useHandCursor = true;
[Code]....
Is there a better way to handle this than what I have above?
View 3 Replies
May 7, 2011
How to show different images for a single button?It should show different images when the mouse pointer is over the button and out of the button.
View 3 Replies
Jan 13, 2010
I'm building a historical timeline app in Flash. The main feature will be an MC containing links to specific event in the history of an organization. The MC will scroll, and there will be a couple ways to scroll it. One type of navigation will be fwd/backward buttons, and I want them to work such that if the button is pressed and held, an MC containing links will scroll w/increasing speed (up to a limit), but if the button is clicked, it will just move the MC a specified amt.
An example of what I want to accomplish can be seen it this HP timeline: [URL]
I think I could do this w/a MOUSE_UP eventListener
View 2 Replies
Apr 27, 2010
so I'm still pretty new to AS3, but I'm making a game for my final project in school. I have to make a side scrolling beat em up game, where you hit the X button to do three different attack animations. I want the next attack to not start until the last ends, and I want the attack animations to reset if you wait too long between X presses.What I've gotten so far works, but is very clunky and I already see reasons down the road for why it's not gunna work well.
ActionScript Code:
var attackTimer:Timer = new Timer(1000);
var attacks:Array = new Array();
[code].....
View 0 Replies
Sep 29, 2009
'm extremely new to Flash and I don't really know how to code yet.. I'm making a website and want to have a single button that when pressed either plays or pauses the music file. I found a tutorial that worked but it has two buttons (one for play and one for stop). You can see the tutorial here:[URL] I'm hoping that someone can tell me how I might be able to change the code so that a single button acts as both play and pause (i.e.; If music is not playing then play, if music is playing then stop).
View 2 Replies
Oct 22, 2010
I am designing a instrument panel and am needing to essentially create an emulation of how the panel would actually work. Right now I have the panel set up to run through a systems test. So I have a button play a movie, and display a verification that the test was successful. On the real panel, you press the same button again to confirm the test. How do you setup the button to go to a different frame than the first time I clicked it? I have come across different possibilities, such as using an "if then" function, but really don't know how to use the syntax, or if that would even accomplish the task at hand.
View 3 Replies
Oct 25, 2009
I currently have a 23-frame multilayered single-scene animation designed to loop continuously which I would like to add to my portfolio. As such, I am adding a Play button, which I would like to toggle to a Stop (or Pause) button. I currently have an instance of the Play button ("playButton") created.
(You can find this at pineboxmovingco.com/gear_redux.swf)
Besides imploring your assistance in providing the code, I must also ask if this requires (and best practice for) inserting an additional frame at the beginning for the ActionScript, as well as where/what layer to add an instance of the Stop button. I would like the movie to be stopped by default, presenting the Play button, toggling to the Stop button, and back to the Play button, each upon release.
View 8 Replies
Jan 27, 2010
I load many SWFs in to my webpage. I need to add a removeChild to my main buttons (HOME, ABOUT US, CONTACT US, etc...) so when exiting from one page to the other all the loaded swfs will be removed.
Is there a way to remove all loaded swfs with one action on a button?
View 2 Replies
Jul 3, 2009
I have buttons that need to be double clicked in order to work when they should only have to be clicked once. Once the button is clicked twice, it only takes one click to work. I have this code on the button itself.
ActionScript Code:
on (release) {
services_btn.onRelease = function() {
[Code].....
View 6 Replies
Sep 21, 2009
I have a movieClip. It has two children, a rectangle shape on layer 2, and a textfield on layer 1. The movieClip is used as a button.
The problem is that the textField and the rectangle are firing mouse "over" and "out" events individually. I want the movieClip to function like the old ActionScript 2 movieClips--as one single button.
I tried
ActionScript Code:
mynew_mc.mouseChildren = false;
but then the movieClip did not respond to any mouse events.
View 7 Replies
Jan 22, 2010
I am creating a "Kiosk" to be used in flash using ActionScript 2.0 with individual scenes. At the end of each scene is an outro and the beginning of each is an intro to give the impression of them all appearing seamless.So on each button I have added the following [code]Frame 180 is where the outro plays to enter the selected scene of that button. I would then like add to this piece of script that I want that button to go to that scene after the outro is played. So it would have something like gotoAndPlay(scene xx);The only other solution I have at the moment would be to make an outro of each scene for each button to jump to but this having 8 scenes it would end up adding up to 64 outros in total.So would there be a solution to simply have each button jump to the one outro then jump to its own scene?
View 3 Replies
Aug 14, 2010
I have an animated storybook that reader moves through each page (scene) with forwardBtn and backBtn. Each scene (in it''s own keyframe) I have placed a voiceover on the time line. When I view movie the forward btn plays scenes and sound correctly. The prolblem is with the back btn, When bacBtn in pressed the previous scene plays but the sound from the other sceane keeps going.actions from back btn below
on (keyPress "<Up>") {
// Locate the screen that is the target of the behavior
var screen = null;
[code].....
View 5 Replies
Sep 16, 2010
I'm looking for an AS2 tutorial or template that will show me how to create ONE button that will stop and resume an SWF file that is made up of several composited movieclip elements. I've found several that use two buttons (start and stop), but I would like one that operates like the single sound on/off buttons you see on many sites.
View 1 Replies
Sep 1, 2011
I want to load 2 swf files with a single button click. I'm currently using 2 different functions with different loaders and I call both functions with the same button, but I get error 2025.
View 3 Replies
Sep 1, 2011
I need to load 2 swf files with a single button click. I'm currently using 2 functions, but I get: ArgumentError: Error #2025: The supplied Display Object must be a child of the caller.[code]because I tried to load everything into a single function and when I used two functions I got error 2025.What code should I use in order to load two swf files at the same time, with a single button click?
View 1 Replies
Apr 24, 2009
on loading multiple external swf on single button... I mean on click of next or previous button may I load external swf with different name on targeted instance....?
View 9 Replies
Jan 23, 2012
I have a problem with two functions. This is the story: the user has to press the space button on keyboard when he sees something on screen, then the "rightClick" function is called. If he presses the button when there is something else on screen that is a wrong answer (function "wrongClick" is called). The problem is that when the user presses the space button both function run at the same time.
This is the call of the wrongtClick function on frame 5
stage.addEventListener(KeyboardEvent.KEY_DOWN, wrongPress);
This is the call of the rightClick function on frame 10
stage.addEventListener(KeyboardEvent.KEY_DOWN, rightPress);
Both function are very simple:
function rightPress(event:KeyboardEvent):void {
scorenum += 1;
trace ("Right:",scorenum);
} function wrongPress(event:KeyboardEvent):void {
wrongnum += 1;
trace ("Wrong:", wrongnum);
//and plays a sound too
}
View 3 Replies
Jan 6, 2009
When the movie loads, the music begins to play. I have a single Music On/Off button that can stop and restart the first track. However, whenever the user stops and then starts the music again, I'd like to alternate the track that plays.
As it stands now, only the the first track will play when the button is clicked (and when the movie loads, of course).
Code in action layer:
ActionScript Code:
var song = 1;
var my_sound:Sound = new Sound();
[Code].....
View 3 Replies
Sep 28, 2002
I need to create a single text field with submit button. The user will simply enter their email address and press submit and it will be sent to an email address of my choosing.
View 3 Replies
Jul 2, 2009
can a button on a single frame be coded to both display a movie clip on its first click and, after a second click, hide the movie clip?
View 3 Replies
Oct 5, 2010
i am new to this site and also to AS i am trying to create a an expand and collapse functionality in which i want a movie clip to shrink and disappear when i click on a button and reappear when i click it again the solution that i came up with was i animated the movie clip shrinking and disappearing and now i think playing the timeline in reverse will solve the other half and i also added the stop script at the 1st and last frame of the movie clip.
i tried a lot and a number tried and tested the no of scripting techniques posted on other threads
View 9 Replies
Sep 21, 2011
how to add mute sound and unmute sound script in a single button?
View 2 Replies
Dec 27, 2010
In one of our project we are using flex for front end, blazeds/java in the backend. Its an existing code where services are prewritten. I have to make calls to 3 services in the backend (basically 3 remote objects) and get their result and store the result in an object and show the data of this object in a view.
Now in front end we are using Flex and Parsley Framework. I was thinking of the following approaches.
1) Making commands for each service call and storing the result in a shared object (model) and then displaying this model in the view. In this approach the problem is some services are needed in some other web pages, but they donot need the same model. How should i handle this scenario ? Should i make a asynchronous remote call and fetch the result and then again dispatch and event with the event object storing the result.
2) Making a service call , wait for the result then make another call and wait for the result and then make other call, not sure if this is the right way ?
View 2 Replies
Aug 23, 2011
I'm using CS3 and want to know if it's possible to give more than 1 instance name to a single MC using AS2? The reason I ask is I have a bunch of templates that I want to load (one at a time) into a master swf that will be used for scaling & positioning of movie clips (which data will be saved to an XML file) in all the loaded swf files. I would like to have some code in the loaded clips that the master swf could use for controlling it's movie clips. This code would reassign the clips a second name so the master swf recognizes the clips in the loaded swfs and is able to manipulate them.
The problem now is I have a lot of template swf files with all different named movie clips and changing all of there instance names one by one will take a long time.I imagine that unless the clips were allowed 2 different names and were just assigned a new one, that it would stop any preexisting code from working correctly.
View 5 Replies
Aug 16, 2009
I had been working on an application.I have developed swf's (around 5) of all the modules of the application. Now I want to make the main SWF, that would display all the other SWF modules at a pre-decided position on the screen. put together all the SWF module onto a single SWF?
View 8 Replies
Feb 18, 2005
i have an xml file containing the news content for a movie. and i have the as below for loading the news and formatting it to my needs. basically what i want is the movie to only load one entry at a time, and then have a next button to go to the next.
Code:
the_xml = new XML();
the_xml.ignoreWhite = true;
parseAll = function () {
if (fileexists == false) {
[code]...
View 1 Replies