Posted By

imhugo on 01/22/08


Tagged

actionscript load loadClip


Versions (?)

Who likes this?

6 people have marked this snippet as a favorite

mbcdg
arala22
jmelgoza
abdsign
hi2shamika20
jschilling


Load Images/Swf's with loadClip


 / Published in: ActionScript
 

  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
Posted By: jmelgoza on February 8, 2008

is this as2 or 3?

Posted By: imhugo on February 14, 2008

jmelgoza, this is as2.

You need to login to post a comment.