Flash CS3 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > MovieClipLoader > addListener (MovieClipLoader.addListener method) | |||
public addListener(listener:Object) : Boolean
Registers an object to receive notification when a MovieClipLoader event handler is invoked.
Availability: ActionScript 1.0; Flash Player 7
listener:Object - An object that listens for a callback notification from the MovieClipLoader event handlers.
Boolean - A Boolean value. Returns true if the listener was established successfully; otherwise false.
The following example loads an image into a movie clip called image_mc. The movie clip instance is rotated and centered on the Stage, and both the Stage and movie clip have a stroke drawn around their perimeters.
this.createEmptyMovieClip("image_mc", this.getNextHighestDepth());
var mclListener:Object = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip) {
target_mc._x = Stage.width/2-target_mc._width/2;
target_mc._y = Stage.height/2-target_mc._height/2;
var w:Number = target_mc._width;
var h:Number = target_mc._height;
target_mc.lineStyle(4, 0x000000);
target_mc.moveTo(0, 0);
target_mc.lineTo(w, 0);
target_mc.lineTo(w, h);
target_mc.lineTo(0, h);
target_mc.lineTo(0, 0);
target_mc._rotation = 3;
};
var image_mcl:MovieClipLoader = new MovieClipLoader();
image_mcl.addListener(mclListener);
image_mcl.loadClip("http://www.helpexamples.com/flash/images/image1.jpg", image_mc);
If your SWF file includes a version 2 component, use the version 2 component's DepthManager class instead of the MovieClip.getNextHighestDepth() method, which is used in this example.
onLoadComplete (MovieClipLoader.onLoadComplete event listener), onLoadError (MovieClipLoader.onLoadError event listener), onLoadInit (MovieClipLoader.onLoadInit event listener), onLoadProgress (MovieClipLoader.onLoadProgress event listener), onLoadStart (MovieClipLoader.onLoadStart event listener), removeListener (MovieClipLoader.removeListener method)
Flash CS3
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00001994.html