User Guide

MovieClip.loadVariables() 541
You can extend the methods and event handlers of the MovieClip class by creating a subclass. For
more information, see “Assigning a class to a movie clip symbol” in Using ActionScript in Flash.
Example
The following example loads information from a text file called params.txt into the target_mc
movie clip that is created using
createEmptyMovieClip(). The setInterval() function is used
to check the loading progress. The script checks for a variable in the params.txt file named
done.
this.createEmptyMovieClip("target_mc", this.getNextHighestDepth());
target_mc.loadVariables("params.txt");
function checkParamsLoaded() {
if (target_mc.done == undefined) {
trace("not yet.");
} else {
trace("finished loading. killing interval.");
trace("-------------");
for (i in target_mc) {
trace(i+": "+target_mc[i]);
}
trace("-------------");
clearInterval(param_interval);
}
}
var param_interval = setInterval(checkParamsLoaded, 100);
/* params.txt includes the following text
var1="hello"&var2="goodbye"&done="done"
*/
See also
MovieClip.loadMovie(), MovieClip.loadVariables(), loadVariablesNum(),
MovieClip.unloadMovie()