How to Control Things with Actionscript
When working with other designers in Flash, I generally serve as the last line of defense for unsolved functionality mysteries. I often find that there’s a mishap that has resulted from changed or lost instance names, effectively decapitating pieces of code. So how do you control things with Actionscript?
The short answer: Instance Names.
For the detailed answer check out this video tutorial using Actionscript 3.
The Actionscript has to know “who” you’re wanting to talk to. Just as we know human beings by name, and talk about them and to them by name, Actionscript references objects by name. A teacher might tell “Timmy” to sit down. Accordingly, your script might tell “circle” to move 10 pixels to the left. If no symbol with the name, “circle” exists, nothing happens; just as no one sits down if there’s no “Timmy” in the classroom.
Referencing nested MovieClips works the same way, just add a dot inbetween:
var clipReference = grandparentClip.parentClip.childClip;
Remember that a symbol name is different than an instance name. You can have multiple instances of a symbol on stage, but each instance name has to be unique. Instance names are set in the Property Inspector, symbol names are set in the Library.
Keep this idea in mind when working with Actionscript and it will make your life a whole lot easier.



