User Guide

MovieClip 901
See also
nextFrame function, prevFrame function, prevFrame (MovieClip.prevFrame
method)
onData (MovieClip.onData handler)
onData = function() {}
Invoked when a movie clip receives data from a MovieClip.loadVariables() call or a
MovieClip.loadMovie() call. You must define a function that executes when the event
handler is invoked. You can define the function on the Timeline or in a class file that extends
the MovieClip class and is linked to a symbol in the library.
You can use this handler only with the
MovieClip.loadVariables() method or the
loadVariables() global function. If you want an event handler to be invoked with
MovieClip.loadMovie() method or the loadMovie() function, you must use
onClipEvent(data) instead of this handler.
Availability: ActionScript 1.0; Flash Player 6
Example
The following example illustrates the correct use of
MovieClip.onData(). It loads a file
named OnData.txt from the same directory as the FLA. When the data from the file is loaded
into the
MovieClip object, onData() executes and we trace out the data.
var mc:MovieClip = this.createEmptyMovieClip("mc",
this.getNextHighestDepth());
mc.onData = function() {
for(var i in this) {
trace(">> " + i + ": " + this[i]);
}
}
mc.loadVariables("OnData.txt");
See also
onClipEvent handler, loadVariables (MovieClip.loadVariables method)