Load Images/Swf's with loadClip


/ Published in: ActionScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // Function constructor
  2. //
  3. function callLoadClip(clip:String):Void
  4. {
  5. // Constructors
  6. var mcLoader:MovieClipLoader = new MovieClipLoader();
  7. var listener:Object = new Object();
  8.  
  9. // Whrn Start loading
  10. listener.onLoadStart = function(target:MovieClip) {
  11. // Actions when loading starts
  12. }
  13.  
  14. // Preloading
  15. listener.onLoadProgress = function(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void
  16. {
  17. var percent:Number = Math.round(bytesLoaded * 100 / bytesTotal);
  18. preloader_txt.text = percent + "%";
  19. }
  20.  
  21. // Loaded
  22. listener.onLoadInit = function(target:MovieClip) {
  23. // Actions when loading ends
  24. }
  25.  
  26. // Init
  27. mcLoader.addListener(listener);
  28. mcLoader.loadClip(clip, loader_mc);
  29. }
  30.  
  31.  
  32. // Call function
  33. //
  34. callLoadClip("images/myImage.jpg");

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.