If you don't have access to Chess.fla (for example, if you are loading Chess.swf from someone
else's site into
chess_mc
Place the following ActionScript on the main Timeline of Games.fla:
chess_mc._lockroot = true;
In this case, Chess.swf can be published for any version of Flash Player, as long as Games.swf
is published for Flash Player 7 or later.
When calling
loadMovie()
movie, as shown in the following code. If you don't set
movie, any references to
the
of the loaded movie:
_root
myMovieClip._lockroot = true;
Availability: ActionScript 1.0; Flash Lite 2.0
Example
In the following example, lockroot.fla has
SWF file is loaded into another FLA document,
lockroot.swf, which helps prevent conflicts. Place the following ActionScript on the main
Timeline of lockroot.fla:
this._lockroot = true;
_root.myVar = 1;
_root.myOtherVar = 2;
trace("from lockroot.swf");
for (i in _root) {
trace(" "+i+" -> "+_root[i]);
}
trace("");
which traces the following information:
from lockroot.swf
myOtherVar -> 2
myVar -> 1
_lockroot -> true
$version -> WIN 7,0,19,0
The following example loads two SWF files, lockroot.swf and nolockroot.swf. The
lockroot.fla document contains the ActionScript from the preceding example. The nolockroot
FLA file has the following code placed on Frame 1 of the Timeline:
_root.myVar = 1;
_root.myOtherVar = 2;
trace("from nolockroot.swf");
for (i in _root) {
trace(" "+i+" -> "+_root[i]);
}
trace("");
490
ActionScript classes
), you can set the Chess.swf
, set the
MovieClip._lockroot
in the loaded movie point to the
_root
_lockroot
property when you load it.
_lockroot
property to
to
_lockroot
_root
applied to the main SWF file. If the
always refers to the scope of
_root
in the loader
true
in the loader
true
of the loader instead of
Need help?
Do you have a question about the FLASHLITE2 ACTIONSCRIPT-LANGUAGE and is the answer not in the manual?
Questions and answers