public static removeListener(listener:Object) : Boolean
Removes an object previously registered with the Selection.addListener() method.
listener:Object - The object that no longer receives focus notifications.
Boolean - If the listener object was successfully removed, the method returns a true value. If the listener object was not successfully removed--for example, if listener was not on the Selection object's listener list--the method returns a value of false.
The following ActionScript dynamically creates several text field instances. When you select a text field, information appears in the Output panel. When you click the remove_btn instance, the listener is removed and information no longer appears in the Output panel.
this.createTextField("one_txt", 1, 0, 0, 100, 22);
this.createTextField("two_txt", 2, 0, 25, 100, 22);
this.createTextField("three_txt", 3, 0, 50, 100, 22);
this.createTextField("four_txt", 4, 0, 75, 100, 22);
for (var i in this) {
if (this[i] instanceof TextField) {
this[i].border = true;
this[i].type = "input";
}
}
var selectionListener:Object = new Object();
selectionListener.onSetFocus = function(oldFocus, newFocus) {
trace("Focus shifted from "+oldFocus+" to "+newFocus);
};
Selection.addListener(selectionListener);
remove_btn.onRelease = function() {
trace("removeListener invoked");
Selection.removeListener(selectionListener);
};