MovieClipLoaderClass - AS2
Jeff August 21st, 2007
I have been reading a lot of questions about how to properly load movies in projects using actionscript2. This is how I do it:
var my_mcl:MovieClipLoader = new MovieClipLoader(); //Used to load the image
button1_mc.onPress = function() {
my_mcl.loadClip(movie1.swf, container_mc); //loading a movie into a container movie clip (just an empty mc on the stage)
};button2_mc.onPress = function() {
my_mcl.loadClip(movie2.swf, container_mc); //loading a movie into a container movie clip (just an empty mc on the stage)
};var mclListener:Object = new Object();
my_mcl.addListener(mclListener);//the three listeners below are optional
mclListener.onLoadStart = function(container_mc:MovieClip) {
//The listener tells this function that downloading the image has begun and to perform whatever code you put here
};
mclListener.onLoadError = function(container_mc:MovieClip, errorCode:String, httpStatus:Number) {
// this function fires if there is an error in loading the movie
trace(”loadListener.onLoadError()”);
trace(”==========================”);
trace(”errorCode: ” + errorCode);
trace(”httpStatus: ” + httpStatus);
}
mclListener.onLoadComplete = function(container_mc:MovieClip) {
//The listener tells this function that downloading the image has completed and to play whatever code is here
}
