removeListener (IME.removeListener method)

public static removeListener(listener:Object) : Boolean

Removes a listener object that was previously registered to an IME instance with IME.addListener().

Availability: ActionScript 1.0; Flash Player 8

Parameters

listener:Object - The object that no longer receives callback notification from the IME event handlers.

Returns

Boolean - Returns true if the listener object is removed; otherwise false.

Example

The following example shows how to remove a listener object from System.IME when a user sets the composition string by clicking in the text field.

var IMEListener:Object = new Object();
IMEListener.onIMEComposition = function(str:String) {
    trace(">> onIMEComposition: " + str);

    System.IME.removeListener(this);
    trace(System.IME.length); // 0
}
System.IME.addListener(IMEListener);
trace(System.IME.length); // 1

var mc:MovieClip = this.createEmptyMovieClip("mc", this.getNextHighestDepth());
mc.createTextField("txt", this.getNextHighestDepth(), 0, 0, 0, 0);
mc.txt.border = true;
mc.txt.background = true;
mc.txt.autoSize = "left";
mc.txt.text = "Click this text to add and remove a listener.";

mc.onPress = function() {
    if(System.capabilities.hasIME) {
        Selection.setFocus(mc.txt);
        System.IME.setCompositionString(mc.txt.text);
    }
}