Showcase and discover digital art at yex

Follow Design Stacks

Subscribe to our free newsletter to get all our latest tutorials and articles delivered directly to your inbox!

Loading in Images Using the MovieClipLoader Class

Loading in Images Using the MovieClipLoader Class

Loading in MovieClips (JPEGs or SWFs) is easier than ever now with the MovieClipLoader class. Before, when loading in MovieClips using the MovieClip.loadMovie method the onLoad method wouldn’t always work, which meant that you wouldn’t always be able to know when exactly the clip you were trying to load had finished loading. Now with the MovieClipLoader class you can track events much easier.

The following code demonstrates how to create an instance of the MovieClipLoader class, create a listener object which will wait for the JPEG image to finish loading in and finally how to call the loadClip method:

  1. var mclListener:Object = new Object();
  2. mclListener.onLoadInit = function(target_mc:MovieClip) {
  3.     target_mc._rotation = 5;
  4. };
  5. var logo_mcl:MovieClipLoader = new MovieClipLoader();
  6. logo_mcl.addListener(mclListener);
  7. logo_mcl.loadClip(“logo.jpg”, this.createEmptyMovieClip(“logo_mc”, this.getNextHighestDepth()));