03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Mouse.addListener(mouseListener);<br />

my_mc.onPress = function() {<br />

this.startDrag();<br />

};<br />

my_mc.onRelease = function() {<br />

this.stopDrag();<br />

};<br />

See also<br />

globalToLocal (MovieClip.globalToLocal method)<br />

_lockroot (MovieClip._lockroot property)<br />

public _lockroot : Boolean<br />

A Boolean value that specifies what _root refers to when a SWF file is loaded into a movie<br />

clip. The _lockroot property is undefined by default. You can set this property within the<br />

SWF file that is being loaded or in the h<strong>and</strong>ler that is loading the movie clip.<br />

For example, suppose you have a document called Games.fla that lets a user choose a game to<br />

play, <strong>and</strong> loads the game (for example, Chess.swf) into the game_mc movie clip. Make sure<br />

that, after being loaded into Games.swf, any use of _root in Chess.swf will refer to _root in<br />

Chess.swf (not _root in Games.swf). If you have access to Chess.fla <strong>and</strong> publish it to Flash<br />

Player 7 or later, you can add this statement to Chess.fla on the main Timeline:<br />

this._lockroot = true;<br />

If you don't have access to Chess.fla (for example, if you are loading Chess.swf from someone<br />

else's site into chess_mc), you can set the Chess.swf _lockroot property when you load it.<br />

Place the following ActionScript on the main Timeline of Games.fla:<br />

chess_mc._lockroot = true;<br />

In this case, Chess.swf can be published for any version of Flash Player, as long as Games.swf<br />

is published for Flash Player 7 or later.<br />

When calling loadMovie(), set the MovieClip._lockroot property to true in the loader<br />

movie, as shown in the following code. If you don't set _lockroot to true in the loader<br />

movie, any references to _root in the loaded movie point to the _root of the loader instead of<br />

the _root of the loaded movie:<br />

myMovieClip._lockroot = true;<br />

446 ActionScript classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!