Another way to do this would be to use the keyword this. When you use this, you are referring to the current level. So this at the root level is the same thing as _root. However, this inside the movie clip “gears” will be the same as gears. the following three lines mean the same thing at the root level:

gears.gotoAndStop(7);
_root["gears"].gotoAndStop(7);
this["gears"].gotoAndStop(7);

So which one should you use? The advantage of using _root and this is that you can refer to movie clips by variables. For instance, you could do this:

var whichClipToUse = “gears”;
this[whichClipToUse].stop();

The advantage of using this over _root is that you will not always have everything happening at the root level. Sometimes movie clips will issue commands to other movie clips at lower levels, and you will need to use this to make it work. Therefore, this wins out as the best way to refer to movie clips. However, in simple cases, it will be better to just refer to movie clips by name like we did in the last example.

Taken From: Sams Teach Yourself Flashâ„¢ MX ActionScript in 24 Hours

Leave a Reply