PDA

View Full Version : variables and roots


youkou-chan
12-22-2009, 12:28 AM
Can somebody explain to me the basics of variables and roots?

meminus
12-22-2009, 12:44 PM
Hey!

A Variable (Var) is like a shortcut in actionscript.

For example:
var myName = meminus
aTextField.text = (myName);

instead of writing (both codes are functioning exactly the same way)
aTextField.text = (meminus);

In this case it might not matter but when you´ve got long calculations or the displayname in many places it can be handy to just change the name in one place.

_root is when you tell something to go back to the main timeline.
If you have a button inside a Movie Clip which is placed on your main timeline and when pressed you want flash to go to the main timeline and play frame 2. If you don´t use _root the button will go to frame 2 inside that movieclip.