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


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 :: Change String Variable To A MovieClip Variable?

Oct 10, 2008

I have been banging my head against a brick wall regarding the following problem which must be very simple to fix, just can't see the answer.I have a class assigned to a movieclip called canvas. The class is called drawClass. I have called the instance of canvas on the stage 'drawingCanvas'.When I trace "drawingCanvas" I get object drawClass] which is fine. Tracing drawingCanvas.name gets me the instance name 'drawingCanvas'.This is a String variable.Basically what I am trying to do is pass the MovieClip name to another class. In my example the class 'toolBar', which can then interact with the MovieClip.

The problem is passing 'drawingCanvas.name' results in a String, so I get an error saying :TypeError: Error #1034: Type Coercion failed: cannot convert "canvasArea" to flash.display.MovieClip.I can't for love or money find a way to convert a String variable to a MovieClip variable! I have the name of the MovieClip, I just need to tell the toolbar class. But I can't find a way of doing this as the instance on stage is an object of drawingClass, not a MovieClip (unless MovieClips with attached classes are not treated as standard MovieClips?).

View 9 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 :: Change Frame In Main Timeline?

Apr 2, 2011

I made an RPG, and I'm trying to make the movie itself go to the second/next frame. But whenever I try to do that, nothing happens at all. I tried _level0.gotoAndStop(2) and _root.gotoAndStop(2), both on a frame and on a movie clip.

It's suppose to initiate this function once a certain variable (_root.numbers) reaches 20, and I've tested if the variable does reach 20 by doing other things.

View 0 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 3.0 :: Change Array Data From Main Timeline?

Apr 7, 2011

Let's say I have a file that loads an AS. Within that AS is an array that loads to a list menu in the main file or .fla. The list menu is used as navigation, so when the user clicks on one of the items, in the list, it goes to, let's say, frame 2.Now, on frame 2 I would like to change the information in the array so that the list menu now contains a new list of links.

View 2 Replies

ActionScript 3.0 :: Movieclip To Act Independently Of The Main Timeline FPS Change?

Jun 19, 2009

My question. How do I control a movie clips FPS independently of the main time line. I believe in the previous version of Flash this was not possible but I think it can be done with CS4 with AS3.
 
I have five images with motion add to them. One fades out while the next fades in. To get this to work slower then the main time line I would have to add a lot of frame for that movie clip to not run so fast. Which this will make the file size larger.
 
I need this movie clip to run at say 12 FPS instead of the 24 the main timeline is running at.

View 1 Replies

ActionScript 3.0 :: Mp3 File In Main Timeline - Change Its Volume?

Nov 23, 2010

I Have  one Mp3 file in main timeline. how to change volume

View 1 Replies

ActionScript 3.0 :: Change Frame In The Main Timeline From A Symbol?

Jan 17, 2011

I need to use, GoToAndStop(), from a Symbol, that is not on the Timeline, to change the current frame on the Timeline.

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 :: 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 :: 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 :: 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 :: Accessing A Class Private Variable In The Main Timeline?

Jun 2, 2011

Here's my main class:
 
[code]...
 
in the timeline I have a dynamic text box named my_textbox: var my_test:main = new main(); my_test.check_DVBViewer(); my_textbox.text = ??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 3 Replies

ActionScript 3.0 :: Flash Movieclip Read Variable From Main Timeline?

Aug 25, 2010

I declared a variable & it's value in the main timeline. Then I created a movieclip and have some actionscript inside that movieclip. Is it possible to read the varialbe's value within the movieclip?

Let's say I have this variable in root timeline var myVar:Number = 100; and I want to read myVar's value within a movieclip like following trace(root.myVar);

View 3 Replies

ActionScript 2.0 :: Change A Variable Of The Main Fla?

Feb 21, 2007

Can you change a variable of the main Fla with code that is is an externaly loaded swf?

Is this what a _global variable does?

View 2 Replies

ActionScript 3.0 :: Timer To Control Main Timeline Change Giving Me Bad Results

Oct 3, 2009

I have a timer to try and have my main timeline frame change every X amount of time. I just would like to cycle the frames as if they were an image slideshow or something. It works almost works by this I mean It will cycle frames 1-4 but then it wont go back to 1 with this code. It will go to frame 2 after frame 4 then the timing and randomness get even worse.[code]

View 6 Replies

ActionScript 3.0 :: Menu Buttons - Changing Variable Loader On Main Timeline

Oct 22, 2008

I am creating a very basic menu. My project consists of a main file that then calls other swf's to fill in the rest of the content. My main timeline is this. There is an preloader which hasn't been built yet, a intro section that is two movie clips (one loads the layout, one fades in my buttons). Then when all this loads, I load the first swf. My difficulty is that I am trying to get my buttons, which are held in mc_buttons, to change the variable myLoader on the main timeline. So when you click on a button, it swaps in a different swf for the current loaded one. I have tried calling the following code attached below.

My error is:
"1119: Access of possibly undefined property myLoader through a reference with static type flash.display:DisplayObjectContainer."
Now, if I define the myLoader variable in the mc_buttons and do an addchild() there, I get the correct content, it just is on top of the old content which isn't what I want...

View 12 Replies

Flash :: Check And Reset Variable On Main Timeline From Inside A Movieclip?

Feb 11, 2010

I'm converting an old AS2 file into AS3 (and trying to learn AS3 at the same time).A movie clip contains a number of different animated sequences and buttons within the application trigger these different sequences.The buttons are functional only when an animation has completed playing.

In AS2, I achieved this with a var called _root.animating which was initially set to "false" and switched to true when the animation played and switched back to false at the end of the anim sequence. The buttons checked this var when clicked. Here is some of the AS2.[code]...

View 2 Replies

ActionScript 3.0 :: Act On Change In String Variable

Apr 7, 2009

What is the best way to listen for and trigger a function when a string stored in a variable changes? I have a variable named source which is a string. When its value changes I need to run a function newVideo. What's the most efficient way to detect the string has changed?

View 3 Replies

ActionScript 3.0 :: Create A Global Vars On The Main Timeline And Change It Within Another Movie Clip

Oct 28, 2009

I need to create a global var in AS3 so that I can create the var on the main timeline and change it within another movie clip.

View 3 Replies

ActionScript 3.0 :: React To A Change In A String Variable?

Sep 18, 2009

I have a large block of code in frame one of a movie. It executes, then the movie progresses to frame 2 and stops.I then have buttons at frame 2 that change the value in a string variable and send the movie back to frame 1 where it executes the code with the new value and proceeds to stop in frame 2 again.How can I eliminate this use of frame 2?How do I set it up so that I just re-run the code when the variable changes?I assume I can put all my code inside a function that gets called when the variable changes.

View 2 Replies

Actionscript 3.0 :: Catch A Variable Content (set On The Main Timeline) From A Movie Clip Added To The Stage?

Sep 23, 2010

I'm trying to catch a variable content (set on the main timeline) from a movie clip added to the stage. I need to set a condition with that variable, so here's my line :

Code: Select allif (MovieClip(root).screenMode == ("full"))

But it's not working, I'm also trying to trace the variable with that command :

Code: Select alltrace(MovieClip(root)[screenMode]);

But this doesn't work too.

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 :: 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







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