View Single Post
Nutrox's Avatar Nutrox Nutrox is offline Super Moderator 17 Creative Assets 2007-08-20 #2 Old  
Hi cmoore, welcome to Ultrashock.

The Loader class is what you need to be looking at really. It is the main class you will use to load external SWF and image files.

It is difficult to tell how much of this you have already picked up but here is a quick example of how to load an external SWF file and listen for progress/complete events.

ActionScript Code:
  1. // A URLRequest object pointing to the external movie.
  2. var mainURL:URLRequest = new URLRequest( "movie.swf" );
  3.  
  4. // A Loader object (use to load SWF, PNG, GIF, JPG).
  5. var mainMovie:Loader = new Loader();
  6.  
  7. // Add listeners to the Loader.contentLoaderInfo object.
  8. mainMovie.contentLoaderInfo.addEventListener( ProgressEvent.PROGRESS, progressListener );
  9. mainMovie.contentLoaderInfo.addEventListener( Event.COMPLETE, completeListener );
  10.  
  11. // Load the external movie using the URLRequest.
  12. mainMovie.load( mainURL );
  13.  
  14. // Invoked while the exteral movie is loading.
  15. function progressListener( event:ProgressEvent ):void
  16. {
  17.     trace( "progress = " + event.bytesLoaded );
  18.    
  19.     // This is where you would update the progress bar.
  20. }
  21.  
  22. // Invoked when the external movie has completed loading.
  23. function completeListener( event:Event ):void
  24. {
  25.     trace( "complete" );
  26.    
  27.     addChild( mainMovie );
  28.    
  29.     // It would be a good idea to remove the
  30.     // mainMovie.contentLoaderInfo listeners here as well.
  31. }
If you need any more help feel free to ask.

Reply With Quote