View Full Version : Variables
buddylee
October 22nd, 2002, 09:29 PM
I know in Visual Basic there is are two types of variables... local and global. Is there such a thing in Flash MX? For instance, if I create a varible such as "finish line = 20" for a movie clip, is that variable still true if I use it in a different movie clip? Or do I have to make it a varibale for the whole entire animation?
If you cant understand, I will try to explain further.
Thanks
upuaut
October 23rd, 2002, 01:28 AM
I can tell you, in Flash 5.0, that there are only local variables, but I do remember speak from the masters (Supra and Pom) about global variables and how to create them in MX, and how to artificialy imitate them in 5.0. I'd suggest doing a 'search' in the MX and Action script forum here using the keywords 'global' and 'variables'. I'll bet you'll find the thread they were discussing it in.
Allen
October 23rd, 2002, 04:43 PM
Yes there is indeed global and local variables
To properly use them you need to specify them as such:
finishLine = 20 //would be local to the movie clip it is in
_global.finishLine = 30 //would become global regardless of movie clip it is in.
Depending on the movie clip you are in you can refrence any variable using the specified path such as:
_root.movieClipA.finishLine = 20
or
_global.finishTime = _root.movieClipA.finishLine
Just make sure you define the path to the variable and all will work superb!!!
I should also specify that you can use the same named variable in diffrent movie clips!
Hope this helps!
pom
October 23rd, 2002, 05:41 PM
RAHHHHH!!! Does anybody read the AS tricks?? (http://www.kirupa.com/developer/actionscript/as_tricks.asp) :(
Allen
October 23rd, 2002, 05:49 PM
HOLY COW!!!!!
It was there the whole time............ ;)
Thanks for the link...
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.