Published in: ActionScript
A wrapper function for the MovieClipLoader class, it creates a MovieClipLoader object and adds listeners to it.
/** * A wrapper function for the MovieClipLoader class, it creates a MovieClipLoader object * and adds listeners to it. It should be customized with a preloader * * @param url The absolute or relative URL of the SWF, JPEG, GIF, or PNG file to be loaded. * @param target The target path of a movie clip into which the movie will be loaded. * @return The loadListener object that works with the loader object */ function customLoadClip(url:String, target:MovieClip):Object { var loader:MovieClipLoader = new MovieClipLoader(); var loadListener:Object = new Object(); loader.addListener(loadListener); loader.loadClip(url, target); loadListener.onLoadStart = function(target:MovieClip) { }; loadListener.onLoadProgress = function(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void { var percent:Number = Math.floor(bytesLoaded/bytesTotal*100); }; loadListener.onLoadInit = function(target:MovieClip):Void { }; loadListener.onLoadError = function(target:MovieClip, errorCode:String, httpStatus:Number):Void { trace("LOAD ERROR : " + errorCode + "\>httpStatus : " + httpStatus +"\n"); }; return loadListener; }
You need to login to post a comment.
