I have been reading a lot of questions about how to properly load movies in projects using actionscript2. This is how I do it:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 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 } |