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 />

this.gotoAndPlay(1);<br />

Then, add the following code (<strong>and</strong> the content you want to load) on Frame 3:<br />

stop();<br />

See also<br />

nextFrame function, prevFrame function, prevFrame (MovieClip.prevFrame<br />

method)<br />

onData (MovieClip.onData h<strong>and</strong>ler)<br />

onData = function() {}<br />

Invoked when a movie clip receives data from a MovieClip.loadVariables() call. You must<br />

define a function that executes when the event h<strong>and</strong>ler is invoked. You can define the<br />

function on the Timeline or in a class file that extends the MovieClip class <strong>and</strong> is linked to a<br />

symbol in the library.<br />

You can use this h<strong>and</strong>ler only with the MovieClip.loadVariables() method or the<br />

loadVariables() global function. If you want an event h<strong>and</strong>ler to be invoked with<br />

MovieClip.loadMovie() method or the loadMovie() function, you must use<br />

onClipEvent(data) instead of this h<strong>and</strong>ler.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 6<br />

Example<br />

The following example illustrates the correct use of MovieClip.onData(). It loads a file<br />

named OnData.txt from the same directory as the FLA. When the data from the file is loaded<br />

into the MovieClip object, onData() executes <strong>and</strong> we trace out the data.<br />

var mc:MovieClip = this.createEmptyMovieClip("my_mc",<br />

this.getNextHighestDepth());<br />

mc.onData = function() {<br />

for(var i in this) {<br />

trace(">> " + i + ": " + this[i]);<br />

}<br />

}<br />

mc.loadVariables("OnData.txt");<br />

See also<br />

onClipEvent h<strong>and</strong>ler, loadVariables (MovieClip.loadVariables method)<br />

MovieClip 913

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

Saved successfully!

Ooh no, something went wrong!