03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

}<br />

trace("");<br />

The lockroot.swf file has _lockroot applied to it, <strong>and</strong> nolockroot.swf does not. After the files<br />

are loaded, each file outputs the values variables from their _root scopes. Place the following<br />

<strong>ActionScript</strong> on the main Timeline of a FLA document:<br />

this.createEmptyMovieClip("lockroot_mc", this.getNextHighestDepth());<br />

lockroot_mc.loadMovie("lockroot.swf");<br />

this.createEmptyMovieClip("nolockroot_mc", this.getNextHighestDepth());<br />

nolockroot_mc.loadMovie("nolockroot.swf");<br />

function dumpRoot() {<br />

trace("from current SWF file");<br />

for (i in _root) {<br />

trace(" "+i+" -> "+_root[i]);<br />

}<br />

trace("");<br />

}<br />

dumpRoot();<br />

which traces the following information:<br />

from current SWF file<br />

dumpRoot -> [type Function]<br />

$version -> WIN 7,0,19,0<br />

nolockroot_mc -> _level0.nolockroot_mc<br />

lockroot_mc -> _level0.lockroot_mc<br />

from nolockroot.swf<br />

myVar -> 1<br />

i -> lockroot_mc<br />

dumpRoot -> [type Function]<br />

$version -> WIN 7,0,19,0<br />

nolockroot_mc -> _level0.nolockroot_mc<br />

lockroot_mc -> _level0.lockroot_mc<br />

from lockroot.swf<br />

myOtherVar -> 2<br />

myVar -> 1<br />

The file with no _lockroot applied also contains all of the other variables that the root SWF<br />

file contains. If you don't have access to the nolockroot.fla, you can use the following<br />

<strong>ActionScript</strong> added to the main Timeline to change the _lockroot in the preceding main<br />

FLA document:<br />

this.createEmptyMovieClip("nolockroot_mc", this.getNextHighestDepth());<br />

nolockroot_mc._lockroot = true;<br />

nolockroot_mc.loadMovie("nolockroot.swf");<br />

which then traces the following:<br />

MovieClip 909

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

Saved successfully!

Ooh no, something went wrong!