Posted By

1man on 08/16/07


Tagged

actionscript event content external listner


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

jrutter
arala22
jmelgoza
dazza


Load External Content to Flash and Add an Event Listner


 / Published in: ActionScript
 

Loads some external content into a flash files and places it into a holder movie clip. Once the content has been loaded and the first frame initialised the trace code is run.

  1. //Create an empty holding movie clip on the stage
  2. this.createEmptyMovieClip("mcHolder",this.getNextHighestDepth());
  3.  
  4. //create an new object for the event listner
  5. var oListner:Object = new Object();
  6. //Waits for first frame to be initialised (loaded) then executes the code
  7. oListner.onLoadInit = function(mcContent:MovieClip):Void {
  8. trace(mcContent._name);//passes the name of the content loaded to a trace
  9. };
  10.  
  11. //create a new movie clip loader object.
  12. var mclLoader:MovieClipLoader = new MovieClipLoader();
  13. //Passes any listen events to the listner object
  14. mclLoader.addListener(oListner);
  15. //Load the selected content into the holder movie clip
  16. mclLoader.loadClip("n.swf", mcHolder);

Report this snippet  

You need to login to post a comment.