MovieClipLoader.onLoadError
639
Description
Listener; invoked when a file loaded with
MovieClipLoader.loadClip()
has completely
downloaded. The value for
target_mc
identifies the movie clip for which this call is being made.
This is useful if multiple files are being loaded with the same set of listeners.
This parameter is passed by Flash to your code, but you do not have to implement all of the
parameters in the listener function.
When you use the
onLoadComplete
and
onLoadInit
events with the MovieClipLoader class, it’s
important to understand how this differs from the way they work with your SWF file. The
onLoadComplete
event is called after the SWF or JPEG file has loaded, but before the application
has been initialized. At this point it is impossible to access the loaded movie clip’s methods and
properties, and because of this you cannot call a function, move to a specific frame, and so on. In
most situations, it’s better to use the
onLoadInit
event instead, which is called after the content
has loaded and is fully initialized.
Example
The following example loads an image into a movie clip instance called
image_mc
. The
onLoadInit
and
onLoadComplete
events are used to determine how long it takes to load the
image. The information displays in a dynamically created text field called
timer_txt
.
this.createEmptyMovieClip("image_mc", this.getNextHighestDepth());
var mclListener:Object = new Object();
mclListener.onLoadStart = function(target_mc:MovieClip) {
target_mc.startTimer = getTimer();
};
mclListener.onLoadComplete = function(target_mc:MovieClip) {
target_mc.completeTimer = getTimer();
};
mclListener.onLoadInit = function(target_mc:MovieClip) {
var timerMS:Number = target_mc.completeTimer-target_mc.startTimer;
target_mc.createTextField("timer_txt", target_mc.getNextHighestDepth(), 0,
target_mc._height, target_mc._width, 22);
target_mc.timer_txt.text = "loaded in "+" ms.";
};
var image_mcl:MovieClipLoader = new MovieClipLoader();
image_mcl.addListener(mclListener);
image_mcl.loadClip("http://www.macromedia.com/images/shared/product_boxes/
112x112/box_studio_112x112.jpg", image_mc);
See also
MovieClipLoader.addListener()
,
MovieClipLoader.onLoadStart
,
MovieClipLoader.onLoadError
MovieClipLoader.onLoadError
Availability
Flash Player 7.
Usage
listenerObject
.onLoadError = function(
target_mc:Object
,
errorCode:String
) {
Summary of Contents for FLEX-FLEX ACTIONSCRIPT LANGUAGE
Page 1: ...Flex ActionScript Language Reference...
Page 8: ......
Page 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0...
Page 76: ......
Page 133: ...break 133 See also for for in do while while switch case continue throw try catch finally...
Page 135: ...case 135 See also break default strict equality switch...
Page 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while...
Page 808: ...808 Chapter 7 ActionScript for Flash...
Page 810: ...810 Appendix A Deprecated Flash 4 operators...
Page 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code...
Page 816: ...816 Appendix B Keyboard Keys and Key Code Values...
Page 822: ...822 Index...