PDA

View Full Version : global variables


eggnogg
05-13-2003, 12:40 PM
heya!

i was wondering about this wonderfull idea called global variable! ;) it's a good one! hehe

to put a global variable on a movieClip i'll have to make the following statement : _global.variable = value
correct?

another question:

i have a MC "form". Inside the MC i declare the following : _global.tag = (combo1.getSelectedItem().label);

This piece of code is attached to a button, that is on the same timeline as the comboBox, both inside "form" MC, on frame 1.

now, can i retrieve the var tag's value in a dynamic text box that has it's variable set to "tag", in a another movie (in this case, in the MC "formResult", located on the same timeline of "form" MC?

regards
eggnogg :cool:

Slowburn
05-13-2003, 08:57 PM
when defining or creating a variable and you want anything to access it use the _global prefix.


_global.variable = value;

then you can read this variable form anywhere in your movie, no matter what movieClip it's in. you don't need the _global prefix when reading a variable that has already been created, only for creating it do you need the _global prefix.