Flash CS3 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > MovieClipLoader > removeListener (MovieClipLoader.removeListener method) | |||
public removeListener(listener:Object) : Boolean
Removes the listener that was used to receive notification when a MovieClipLoader event handler was invoked. No further loading messages will be received.
Availability: ActionScript 1.0; Flash Player 7
listener:Object - A listener object that was added by using MovieClipLoader.addListener().
Boolean - A Boolean value. Returns true if the listener was removed successfully; otherwise false.
The following example loads an image into a movie clip, and enables the user to start and stop the loading process using two buttons called start_button and stop_button. When the user starts or stops the progress, information is displayed in the Output panel.
this.createEmptyMovieClip("image_mc", this.getNextHighestDepth());
var mclListener:Object = new Object();
mclListener.onLoadStart = function(target_mc:MovieClip) {
trace("\t onLoadStart");
};
mclListener.onLoadComplete = function(target_mc:MovieClip) {
trace("\t onLoadComplete");
};
mclListener.onLoadError = function(target_mc:MovieClip, errorCode:String) {
trace("\t onLoadError: "+errorCode);
};
mclListener.onLoadInit = function(target_mc:MovieClip) {
trace("\t onLoadInit");
start_button.enabled = true;
stop_button.enabled = false;
};
var image_mcl:MovieClipLoader = new MovieClipLoader();
//
start_button.clickHandler = function() {
trace("Starting...");
start_button.enabled = false;
stop_button.enabled = true;
//
image_mcl.addListener(mclListener);
image_mcl.loadClip("http://www.helpexamples.com/flash/images/image1.jpg", image_mc);
};
stop_button.clickHandler = function() {
trace("Stopping...");
start_button.enabled = true;
stop_button.enabled = false;
//
image_mcl.removeListener(mclListener);
};
stop_button.enabled = false;
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.
addListener (MovieClipLoader.addListener 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/00002004.html