This content has been marked as final. Show 4 replies
var is simply used to define a variable. once that variable is declared, all you need to do is call it's name. for instance....
myVar = createEmptyMovieClip("dummy_mc", 1);
Okey, so the set var value is not exclusive for itself. That is, you can refere to it in actionscripts written for other objects. I´m kind of new in the whole script thing. I posted a topic earlier today with an example. Its http://surface2airparis.com/pg/ and has a menu that is animated. Regardless of which menu you click the prior visited menu "goes" back to its initial position. Can you solve this problem without using var values?
If someone could explain thorougly how you do this menu I would be very greatful.
I'm not exactly sure what you mean. Vars are necessary for anything of this nature. In the case of this file, they are also using XML from the looks of things to handle the loading of the sub-menus and each of these options are turned into text fields and the Tween class is probably used to bring them from 0-100 alpha. There is no way you could accomplish something like this without variables.
a variable is used to store something. that may be a string, a number or an object (which encompasses all instances of the flash classes including, but not limited to, movieclips, textfields, dates, bitmaps etc etc etc) reference.
when you prefix that variable's name with var, you're making that variable local to the object in which it is defined. when that's a timeline, it's no big deal. variables are local to timelines even when they are not prefixed by var.
but when that variable is prefixed by var and defined within a function, that variable is not defined outside the function.
so, "var" has a very specific meaning in flash and is a reserved word. a variable is a general term that has the same meaning in flash as it does in every other programming language of which i am aware and has the same meaning in mathematics: it's something that contains a reference to something else.