Posted By

visualadvance on 06/05/09


Tagged

actionscript 3 loader as3 URLRequest loadmovie


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

akashaman
sultano
TrentSkunk
tspitzr


AS3: Load Movie (URLRequest)


 / Published in: ActionScript 3
 

Just a quick reference for myself of the basics for loading a movie.

  1. import flash.display.Loader;
  2. import flash.net.URLRequest;
  3. import flash.events.ProgressEvent;
  4.  
  5. private function loadFile (path:String):void
  6. {
  7. var myLoader:Loader = new Loader ();
  8. var myRequest:URLRequest = new URLRequest (path)
  9. myLoader.load (myRequest);
  10.  
  11. myLoader.contentLoaderInfo.addEventListener (ProgressEvent.PROGRESS, loadProgress);
  12. myLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, loadComplete);
  13. }
  14.  
  15. private function loadProgress (evt:ProgressEvent):void
  16. {
  17. var amountLoaded:Number = (evt.bytesLoaded / evt.bytesTotal)*100;
  18. trace ("Loading: % " + amountLoaded);
  19. }
  20.  
  21. private function loadComplete (evt:Event):void
  22. {
  23. trace ("Complete - " + evt.target.content);
  24. }
  25.  
  26. //loadFile ("main.swf");

Report this snippet  

You need to login to post a comment.