ActionScript 2.0 :: Change Value Of Variable In Mc From Another Swf?
Mar 29, 2004
I have one swf file that containes a mc using an easing function to move an arrow around. That mc has the instance named myruler. The arrow moves based on the value of a variable named "y". This swf also has a mc that I use as a container to load movies into. The movies that are loaded into the container mc have buttons that I would like to use to change the value of the variable "y" in the movie clip named myruler found in my base swf. Did that make sense? [code]...
Im really new to as3, and im just trying out some stuff, but i cant get a shape to refresh and change when i change its variable using a text field.If i change the text fields text before i test it, it works, but while its running it doesnt change it again.Btw, trying to change the stroke size.[code]i just want is so that when i change the strokeSize_txt text box, it will change the stroke for the shape.
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?).
I'm creating a board game which has 3 variables, p1Move, p2Move and activePlayer. p1Move and p2Move store the p1 and p2 location on a game board. activePlayer stored who's turn it is at the moment.
I am loading a value in from a text file which changes the value of move. This all works fine when i designate a player directly:
so that flash changes the value of p1Move (or p2Move depending on who's turn it is) to varAmount. varAmount is the variable being read from the textfile.
Hopefully that all makes sense. Basically i want flash to change the variable associated with the active player only.
I have an flash movie with on the main timeline a movieclip "MC1". In this movieclip I have another movieclip "MC2". On the first frame of MC1 I have declared a variable x and I want to give this variable a new value when I click on MC2 but it doesn't work?!
I am attempting to make a remoddled clone of the game at [url]...so far i have some blobs that slowly move down through a door, then when they're off the screen they jump back above the screen to come back down.my problem is that the door is user controlled using this code on a butten[code]...
I'm working on a game were your health variable will add 1 hp automatically every second if the health variable is not equal to 100. How would you do that?
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?
I have a flash movie being loaded inside a parent movie. Inside the loaded movie is a variable called lvl, and its refered to as loadedmovie.lvl in the parent movie.
So if i'm wondering what the lvl is in the loaded movie, I just use loadedmovie.lvl to get the variable.
But I want to know when this variable CHANGES. How am I able to detect when this lvl variable changes? Inside the loaded movie, it's been set to change almost every frame in the movie, but I'm not going to call a function inside every frame of that movie to find out when it changes.
how do I detect a variable change and then make it call a function?
Can I detect a change to a variable (a data string)?
I am making a AS2 SWF (player level 7) with a combobox page navigation. I have a page name variable that I am changing from outside of the SWF with Director and Authorware using (I believe) FlashVars. The variable (internally) is set by default during SWF initialization. The external variables values allowed are always one of the combobox's data field values. The combobox default variable is not always index positon 0 (zero). Or the order of the data either. The variable can get changed internally by the nav combobox used for navigation independent of the external variable. - this works When the shared nav var is changed from the external source, the combobox needs to change to the match the corresponding combobox's data variable. This is what I am trying to do. I can change the combobox setting programatically (index) but not get it to recognize it as a change event. Or tell it programatically
Can the combobox be selected by the data variable or is the only option to use the index (and loop through index values to match variable to data field)?
And update the combobox selection (and as a result the nav page) by triggering a change event programatically?
Detecting the var change cleanly without the OnEnterFrame trick is my goal - if it even works in the version I have to use (flash palyer 7).
I need to change one variable at the click of a button the problem is that when I enter the first frame i declared a _global var _global.conteudo =null;
In the second frame: this equal a _global to : _global.conteudo = "enterprise.swf";
But when I click a button , i need change my _global var for example:
on (release){_global.conteudo="my variable declared";}
I've done a search on this and I can't find anything that makes sense
Its the first time I've created a document class and an object class that extends a movieclip. I've tried endless functions and properties to access the public function within the object class, but I'm getting lots of different errors. Both classes are within the same folder as the .fla file. I don't know what I'm doing wrong.[code]...
When the value of _root.mc1._currentframe is 10 I want the value of _root.mc2._currentframe to be written (sent or changed) to a variable which I can use in mc1. So I want to be able to use this variable in different clips but I do not want it to be changed until the playhead in mc1 is in frame 10. However I do want the variable to be valid even if the playhead is not in frame 10. This should be so simple.
So the line xDir = -1; doesn't change variable located in Document Class action script file even if if sentence is true... Is it maybe because it's number?
I am developing a movie, wherein the value of a variable changes over time. I wanted to determing whatever the new value is, immideatly after the value changes, and play a movie clip. Is there a ready-made function for this purpose?
I have a listbox that needs to be populated when a variable is sent to my .swf. What happens is...if the variable is already passed a value before my .swf loads, then it works fine, but the variable will be passed after the .swf loads, so that leaves the listbox empty. would like for the listbox to populate when it notices the variable has been changed. I used object.watch, but it's not successful. Here's my code:
I define a global variable in a swf and then launch a child window which will alter the value of the global variable and I want the parent to detect that event and take specific action. How should I go about this? Can global variables launch events?