user3300378 user3300378 - 4 months ago 24
ActionScript Question

Where can I see the Contents of _root.xxx

My company wants me add something to a .fla file that someone else made, and I have never learned anything about flash since highschool. I'm getting to know the stuff but here is one thing I don't know how to handle.

btnNext.onRelease = function(){
if(test==false){
test = true;
new Tween(_root.inform, "_x", Strong.easeInOut, _root.inform._x, Stage.width*-1, 20, false);
_root.jKey.gotoAndStop(2);
var sound:Tween = new Tween(_root.jKey, "_x", Strong.easeInOut, _root.jKey._x, 40, 20, false);
sound.onMotionFinished = function(){
_root.jKey.loginSound.gotoAndPlay(2);
_root.infoB.gotoAndStop(2);
test = false;
}
}


In the code there is a lot of _root.xxx like
_root.jKey.gotoAndStop(2)
,
_root.infoB.gotoAndStop(2)
.etc
I searched about _root and They all say it's the way to access
level(0)
. but I don't know where to find what comes after _root. I checked the library and there was no such file like jKey or infoB.

I'm using ADOBE FLASH 6 and this action script I think is not 3 but 1 or 2.

Answer

They are instances of MovieClips which have been attached to the root timeline and your code is referencing them by their instance names. They are added to the stage either:

  1. manually, by dragging an item from the library and dropping it on the stage (in which case you should be able to see them on the stage before you compile) or
  2. dynamically in the code, using the attachMovie method to create an instance of an item from the library (see documentation).

If they've been added to the stage manually you can inspect the instance name in the properties panel which should appear when you click the element on stage. If they've been added using the attachMovie method, the instance name is the second parameter of the method used to attach it.