ActionScript 3.0 :: Timeline - Variable Changes Value On Its Own?

Feb 23, 2010

I've just started working with Flash CS4 and Actionscript 3 after being away from Flash for almost 10 years.I've set up a menu that allows users to select from five sections. When users select an option, flow goes to the corresponding section of the timeline and a movieclip plays. Stop actions prevent flow from continuing past the current section. A home button takes users back to the menu in the first frame. This works just fine.The client wants to provide a 'next' button which should play through all sections in sequence when the learner clicks it. I've defined a variable which I set to true when the user clicks 'next'. I've added if...else logic to the stop actions:

trace("nextClicked "+nextClicked);[code]....

This should stop flow unless the play button has been pressed setting the variable nextClicked to true. That's not what happens - flow stops even if when I click the 'next' button. I added the trace to verify the variable has the correct value and discovered that the variable value resets to false from true before it gets to this script.What am I missing about ActionScript 3 that might account for this behaviour?I have tried to read the Actionscript 3 materials but I get bogged down in the complexity of the programming requirements and the lack of depth in the examples provided.I'm sure the examples are perfectly adequate if you're trying to do what they illustrate but I haven't found an example that fits what I'm trying to do here.

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Loading Main Timeline Variable From Movie Clip Timeline?

Feb 2, 2010

I cannot seem to find anything of what I need from google.(Well, I can find the reverse method to what i need ) Basically I wish to access a variable declared in the Root Timeline from my Movie clips timeline.

[Code]...

View 2 Replies

ActionScript 2.0 :: [Flash8] Assign A Variable To The Current Frame Of The Main Timeline (not Movieclip Timeline)?

Mar 16, 2007

I simply want to assign a variable to the current frame of the main timeline (not movieclip timeline) I already know about _currentframe and it doesn't help in this case.

View 4 Replies

Flex :: External SWF Variable Updates Global Variable In Main Timeline?

Feb 8, 2010

I have 2 movie clips, one being loaded into a container MC via "loadMovie();"In the main movie there is a variable with no value, in the external movie there are 5 frames, each with a value to update the variable in the main movie.

IE: if on frame 1, global value = 1 / if on frame 2, global value = 2 / etc etc I'm familiar with passing variables INTO an external swf, but am stumped on how to do it the reverse way.

View 1 Replies

ActionScript 3.0 :: Global Variable And Inner Timeline?

Jun 23, 2009

i've declared global variable in the first frame of the main timeline:var cLabel:String;In the inner timeline of a MC, i use this code:stop();cLabel=this.currentLabel;but flash gave me error 1120: access of undefined property

View 6 Replies

Professional :: Accessing Variable In AS On Other Timeline?

Feb 1, 2011

I have a variable declared in AS code on the main timeline, which I want to access from the timeline of an underlying movieclip. How do I do this?

View 4 Replies

ActionScript 2.0 :: Advance Timeline With Variable?

Feb 23, 2009

Why won't the following work? I have an arrow button that when clicked moves the movie forward 5 frames. The movies does not advance when the button is clicked. The trace only displays "NaN".

on (release) {
var curFrame = _root.theMovieClip.currentframe;
_root.gotoAndStop(curFrame += 5);
trace(curFrame);
}

View 1 Replies

Actionscript 3.0 :: Access Variable From A Different Timeline?

Jan 4, 2010

I am trying to set up a situation where a user types a date into a textbox on the main swf file and then clicks submit. At that point the movie loads an external swf with a dynamic textbox in it that displays the text stored from the variable in the main timeline. How do I made it so that loaded movie can access that that info?

View 3 Replies

ActionScript 2.0 :: Can't Access Timeline Variable

Apr 13, 2007

I have a movie clip I'm duplicating.

This movie clip is only one frame long and has a couple variables and functions in an actions layer on that first frame.

When I duplicate the movie clip I can't access either the variables on the timeline or the functions.

MovieClipA
var blee
var blah
var tempClip:MovieClip = MovieClipA.duplicateMovieClip('createdClip', 100);
trace(tempClip.blee) // This comes back undefined.

Is it not possible to retain the variables and functions inside a movie clip when it gets duplicated?

I know you can define the variables and functions after the duplication but I'd like to be able to have them almost like class attributes / methods for when a new clip is duplicated.

View 1 Replies

ActionScript 3.0 :: Add Value To Main Timeline Variable?

Apr 17, 2009

I'm trying to add a value to a variable inside the Main .SWF from a loaded movie. More clearly,My main movie name is Main.swf. On the main timeline of Main.Swf, I have a variable named currentMovie.Now, I have other movies that are loaded into Main.swf. For example, cars.swf is loaded into Main.swf.What I want to do is have code in cars.swf to add a value to the currentMovie variable in the Main.swf. I just need the correct syntax.

for example,:

MovieClip(parent.parent).currentMovie="some_value" ; is not working for me...

View 3 Replies

ActionScript 2.0 :: Assigning Variable On Different Timeline?

May 7, 2011

I'm using Flash CS4 Professional. I'm new to Flash, taking an on-line college class, and we 've gotten to ActionScript. The entire second page of 'web site' is a movieclip. The mc includes 2 input text boxes and a button. Clicking the button is supposed to take the movie to page 3, a frame on the main timeline. Finally got that to work with 'with (_root) gotoAndPlay ("frame label")'. Page 3 contains 2 dynamic text boxes and I've tried several versions of _root and _parent dot syntax paths and tried 'with (_root)' but I cannot get values from the input boxes in the movieclip to show up in the dynamic boxes on the main timeline.

View 2 Replies

ActionScript 2.0 :: Pass Variable From Main Timeline To MC?

May 11, 2009

How do I pass a variable to be used for a dynamic text box inside a MC from the main timeline?

I am using AS2.0 in Flash CS3

View 2 Replies

ActionScript 1/2 :: Variable To Track Position In Timeline

Sep 10, 2009

I am trying to create a variable in Actionscript 2 that will record the position in the timeline, so Flash knows the user's last position on the timeline.The first line in the mc is: var portfoliostate;On frame 20 of the timeline, I have the following actionscript: portfoliostate = "1_ portfolio";When a button is clicked, I want Flash to recognise if the user has been on frame 20 or not. The code on the button is:this.onRelease = function()[code]However it does not seem to be working. I am implementing this correctly?

View 3 Replies

ActionScript 3.0 :: Pass The Variable From Timeline To Classes?

Jul 25, 2011

I need to pass a boolean variable initially set to false to one of my classes called "EasyGame".It is than changed to true when one of the function in this class is runned.

View 1 Replies

Actionscript :: Can't Access The Variable From Root Timeline

Mar 11, 2011

I created a movieclip called holder in my Stage and I name it, inside them i put a variable called

name = "whatever"

Now I can't access the variable from root timeline, I try this:

trace(holder.name);

The result gives me undefined! what mean this?

View 1 Replies

ActionScript 3.0 :: Change Variable On Timeline From Within A Movieclip?

Aug 27, 2011

I have a varible on the timeline, named "pressedleft" and i have a movieclip named animate, and within that movieclip i have another one named animate_move, on the last frame of animate_move, i want it to make pressedleft = false; but i cant seem to figure out how this is done :s

View 2 Replies

Actionscript 3.0 :: Empty Variable After Switching Timeline / MC?

Jun 21, 2011

I'm having difficulty accessing a variable value within nested MCs.

On Scene 1 in the addFullPanel function, the variable panelNames exists.

However, I'd like to use this variable value within the MC FullProjectPanel in the switch function in order to load a corresponding xml file.

As it stands the variable is empty within the FullProjectPanel function.

View 2 Replies

ActionScript 2.0 :: Passing Variable From Root Timeline Into MC?

Aug 15, 2009

I'm guessing this is pretty simple, I just can't find the solution through my google searches.

Bascially I created a variable and gave it a value in the first frame of my main timeline.

Now I just want to pass that variable into a MovieClip. When I trace the value of the variable within the movieClip I get undefined.

Is there something else I have to do to make it recognize the root timeline's variable?

View 1 Replies

ActionScript 3.0 :: Empty Variable After Switching Timeline Or MC?

Jun 21, 2011

I'm having difficulty accessing a variable value within nested MCs.On Scene 1 in the addFullPanel function, the variable panelNames exists.However, I'd like to use this variable value within the MC FullProjectPanel in the switch function in order to load a corresponding xml file.As it stands the variable is empty within the FullProjectPanel function.

View 1 Replies

ActionScript 1/2 :: Access A Variable On A Main Stage Timeline?

Jul 15, 2009

On my movie clip timeline, what's the syntax to access a variable on a main stage timeline?

View 1 Replies

ActionScript 3.0 :: Change Variable From Instance Timeline Error?

Sep 11, 2009

How do i correctly change a variable from an instances timeline? I need the variable hero.landing to = true when a particular frame is hit in the timeline.

I used to add the instance simply with addChild(name);

and the AS in the timeline was:

MovieClip(this.parent).hero.attacking = false;

However i add the child to the gamelevel instance like:

gamelevel.addChild(name);

and the code: MovieClip(this.parent).hero.attacking = false;

only temporarily changes the variable, it resets back to its previous immediately after the frame is reached.

For example, hero.attacking is true until it hits a certain frame at which point i want it to be set back to false. However now that i add the child into the gamelevel instance, it only temporarily sets hero.attacking to false, and then resets back to true after.

View 0 Replies

ActionScript 3.0 :: Referencing A Variable On The Main Timeline From A .as File

Sep 2, 2010

I am having problems referencing a variable on the main timeline in a .as file using root.variable.

[Code]....

View 6 Replies

ActionScript 2.0 :: Accessing Main Timeline Variable From Within A Class?

Dec 20, 2010

I have a class, the relevant parts of which are defined as follows:

class myClass extends MovieClip {
public function myfunc() {
trace( "mainVar: " + _root.mainVar );
}
}

As you can see, I want to access the variable "mainVar", which exists in the main movie, from within the class. This works fine, if I have only one instance of the class. But, if I have more than one instance, within separate movie clips, the value of mainVar is always taken from the first instance. How do I refer to the actual instance from within the class?

View 0 Replies

ActionScript 3.0 :: Setting A Variable For Pre-existing Movieclip In Timeline?

May 23, 2011

I'm basically trying to reference a number of preexisting movieclips on the stage through a for loop, give it a variable and assign and action. So, where in AS 2.0, I would have gone:

ActionScript Code:
for (var i:Number=1;i<=4;i++){
var refMC:MovieClip=this["myMC"+i];

[code]...

View 9 Replies

ActionScript 3.0 :: Accessing A Class Variable In The Main Timeline?

Jun 2, 2011

Here's my main class:

Code:
package
{
import flash.external.ExternalInterface;

[Code]....

Basically the class waits for the callback variable (my_msg). The problem is: I need to set the dynamic textbox text to my_msg variable.

How can I access it? I know I can access a public var in the timeline with functioname.variable but I can't define a public var inside a function, right?

View 4 Replies

ActionScript 3.0 :: Empty Variable After Switching Timeline Or MovieClip

Jun 21, 2011

I'm having difficulty accessing a variable value within nested MCs. On Scene 1 in the addFullPanel function, the variable panelNames exists. However, I'd like to use this variable value within the MC FullProjectPanel in the switch function in order to load a corresponding xml file. As it stands the variable is empty within the FullProjectPanel function.

View 1 Replies

ActionScript 3.0 :: Get Variable On Main Timeline Into Document Class?

Mar 24, 2009

I have a new FLA with a variable in frame 1:

Code:
var testVar:String = "hello";
//--- my document class:
package

[Code]....

I just get null. How can I see a variable like that?

View 1 Replies

ActionScript 3.0 :: Accessing A Main Timeline Variable From A Class?

May 18, 2010

I'm was getting good with as2 but recently made the mind switch from, I'll learn as3 tomorrow to as3 is awesome. The problem for me is that I don't understand the scope for classes. I know I can trace a variable on the main time line when the var is declared in the class. But how do you access a main time line var from a class? Here's an example - main time line Monkey.fla

Code:
var cagedMonkies:int = 10;
var monkeyTransport:MovieClip = new CarTrunk();

[Code]....

View 13 Replies

ActionScript 3.0 :: Events To Change A String Variable In The Main Timeline?

Jul 14, 2009

I have a navigation bar movieclip that has the following EventListeners in symbol definition:
 
news_btn.addEventListener(MouseEvent.CLICK, clickHandler);function clickHandler(event:MouseEvent):void { event.target.root.gotoAndStop(1,"newsawards");
categoryName = "news"; <<<DOESNT WORK}
clients_btn.addEventListener(MouseEvent.CLICK, clickHandler2);function clickHandler2(event:MouseEvent):void { event.target.root.gotoAndStop(1,"clients");}

[Code]...
 
My question is, how can i cause any of these events to change a string variable in the main timeline? For instance, i would like the news_btn when clicked to change already defined variable located in the main timeline. Also, is there a more elegant way to code the above, i'm new to AS3?

View 2 Replies

Professional :: Access Timeline Variable From Static Class / Singleton?

Nov 3, 2010

How can I access a timeline variable from a static class / singleton?

View 14 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved