Removelistener (Stage.removelistener Method) - MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

removeListener (Stage.removeListener method)

public static removeListener(listener:Object) : Boolean
Removes a listener object created with addListener().
Availability: ActionScript 1.0; Flash Lite 2.0
Parameters
- An object added to an object's callback list with
listener:Object
Returns
- A Boolean value.
Boolean
Example
The following example displays the Stage dimensions in a dynamically created text field.
When you resize the Stage, the values in the text field update. Create a button with an
instance name
remove_btn
this.createTextField("stageSize_txt", this.getNextHighestDepth(), 10, 10,
100, 22);
stageSize_txt.autoSize = true;
stageSize_txt.border = true;
var stageListener:Object = new Object();
stageListener.onResize = function() {
stageSize_txt.text = "w:"+Stage.width+", h:"+Stage.height;
};
Stage.addListener(stageListener);
remove_btn.onRelease = function() {
stageSize_txt.text = "Removing Stage listener...";
Stage.removeListener(stageListener);
}
Select Control > Test Movie to test this example. The values you see in the text field are
updated when you resize the testing environment. When you click
removed and the values are no longer updated in the text field.
See also
addListener (Stage.addListener method)
. Add the following ActionScript to Frame 1 of the Timeline.
.
addListener()
, the listener is
remove_btn
Stage
623

Advertisement

Table of Contents
loading

Table of Contents