MovieClip._lockroot

Availability

Flash Player 7.

Usage

my_mc._lockroot

Description

Property; specifies what _root refers to when a SWF file is loaded into a movie clip. The _lockroot property is undefined by default. You can set this property within the SWF file that is being loaded or in the handler that is loading the movie clip.

For example, suppose you have a document called Games.fla that lets a user choose a game to play, and loads the game (for example, Chess.swf) into the game_mc movie clip. You want to make sure that, if _root is used in Chess.swf, it still refers to _root in Chess.swf after being loaded into Games.swf. If you have access to Chess.fla and publish it to Flash Player 7 or later, you can add this statement to it:

this._lockroot = true;

If you don't have access to Chess.fla (for example, if you are loading Chess.swf from someone else's site), you can set its _lockroot property when you load it, as shown below. 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.

  onClipEvent (load)
  {
    this._lockroot = true;
  }
  game_mc.loadMovie ("Chess.swf");

If you didn't use the this._lockroot = true statement in either of the SWF files, _root in Chess.swf would refer to _root in Games.swf after Chess.swf is loaded into Games.swf.

See also

_root, MovieClip.attachMovie(), MovieClip.loadMovie()