Flash 8 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > MovieClip > 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
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");
onClipEvent handler, loadVariables (MovieClip.loadVariables method)
Version 8
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/8/main/00002487.html
Comments
Fumio Nonaka said on Oct 17, 2005 at 6:57 AM : Fumio Nonaka said on Oct 17, 2005 at 7:47 AM :