MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT Reference Manual page 548

Actionscript reference guide
Hide thumbs Also See for FLASH MX 2004 - ACTIONSCRIPT:
Table of Contents

Advertisement

Example
The following example illustrates the use of many of the MovieClipLoader methods and listeners.
// first set of listeners
var my_mcl = new MovieClipLoader();
myListener = new Object();
myListener.onLoadStart = function (target_mc)
{
myTrace ("*********First my_mcl instance*********");
myTrace ("Your load has begun on movie clip . = " + target_mc);
var loadProgress = my_mcl.getProgress(target_mc);
myTrace(loadProgress.bytesLoaded + " = bytes loaded at start");
myTrace(loadProgress.bytesTotal + " = bytes total at start");
}
myListener.onLoadProgress = function (target_mc, loadedBytes, totalBytes)
{
myTrace ("*********First my_mcl instance Progress*********");
myTrace ("onLoadProgress() called back on movie clip " + target_mc);
myTrace(loadedBytes + " = bytes loaded at progress callback " );
myTrace(totalBytes + " = bytes total at progress callback \n");
}
myListener.onLoadComplete = function (target_mc)
{
myTrace ("*********First my_mcl instance*********");
myTrace ("Your load is done on movie clip = " + target_mc);
var loadProgress = my_mcl.getProgress(target_mc);
myTrace(loadProgress.bytesLoaded + " = bytes loaded at end" );
myTrace(loadProgress.bytesTotal + " = bytes total at end=");
}
myListener.onLoadInit = function (target_mc)
{
myTrace ("*********First my_mcl instance*********");
myTrace ("Movie clip = " + target_mc + " is now initialized");
// you can now do any setup required, for example:
target_mc._width = 100;
target_mc._width = 100;
}
myListener.onLoadError = function (target_mc, errorCode)
{
myTrace ("*********First my_mcl instance*********");
myTrace ("ERROR CODE = " + errorCode);
myTrace ("Your load failed on movie clip = " + target_mc + "\n");
}
my_mcl.addListener(myListener);
//Now load the files into their targets.
// loads into movie clips - strings used as target
my_mcl.loadClip("http://www.somedomain.somewhere.com/
someFile.swf","_root.myMC");
my_mcl.loadClip("http://www.somedomain.somewhere.com/someOtherFile.swf",
"_level0.myMC2");
//failed load
my_mcl.loadClip("http://www.somedomain.somewhere.com/someFile.jpg",
_root.myMC5);
// loads into movie clips - movie clip instances used as target.
my_mcl.loadClip("http://www.somedomain.somewhere.com/someOtherFile.jpg",
_level0.myMC3);
// loads into _level1
my_mcl.loadClip("file:///C:/media/images/somePicture.jpg", 1);
548
Chapter 12: ActionScript Dictionary

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents