/ Published in: ActionScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// Function constructor // function callLoadClip(clip:String):Void { // Constructors var mcLoader:MovieClipLoader = new MovieClipLoader(); var listener:Object = new Object(); // Whrn Start loading listener.onLoadStart = function(target:MovieClip) { // Actions when loading starts } // Preloading listener.onLoadProgress = function(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void { var percent:Number = Math.round(bytesLoaded * 100 / bytesTotal); preloader_txt.text = percent + "%"; } // Loaded listener.onLoadInit = function(target:MovieClip) { // Actions when loading ends } // Init mcLoader.addListener(listener); mcLoader.loadClip(clip, loader_mc); } // Call function // callLoadClip("images/myImage.jpg");