Custom Search

MovieClipLoader Class in Flash 8/Flash MX 2004

MovieClipLoader Class provides you with a rich set of methods that allows you to load an external JPEG image/Swf on a movieclip.





The main advantage of using MovieClipLoader over other methods for loading external Images is:

Methods of MovieClipLoader Class:

Event Listener in MovieClipLoader:

Example on onLoadComplete:

var my_mcl = new MovieClipLoader();
myListener = new Object();
my_mcl.addListener(myListener);
 
myListener.onLoadComplete = function ()
{
trace("Image Successfully Loaded");
}

Example on onLoadInit:

var my_mcl = new MovieClipLoader();
myListener = new Object();
my_mcl.addListener(myListener);
 
myListener.onLoadInit = function (load_mc)
{
trace("Perform Initial Operation");
load_mc._width = x px;
 
}

Example on onLoadError:

var my_mcl = new MovieClipLoader();
myListener = new Object();
my_mcl.addListener(myListener);
 
myListener.onLoadError = function (load_mc)
{
trace("Error Loading Image Please Try Again");
}

Important Note:
There is a strange behavior in the MovieClipLoader class where regards to image caching. Once the MovieClipLoader class is initialized it stays in the memory even after calling removeListener and unloadClip method. To solve this problem refer to this link : Solution to MovieClipLoader Caching Issue

Similar Posts

Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.

Comments

No comments yet.

Leave a comment

(required)

(required)