onIMEComposition (IME.onIMEComposition event listener)

onIMEComposition = function([readingString:String]) {}

Notified when the IME composition string is being set. To use this listener, you must create a listener object. You can then define a function for this listener and use IME.addListener() to register the listener with the IME object, as in the following code:

var someListener:Object = new Object();
someListener.onIMEComposition = function () {
    // statements
}
System.IME.addListener(someListener);

Listeners enable different pieces of code to cooperate because multiple listeners can receive notification about a single event.

Availability: ActionScript 1.0; Flash Player 8

Parameters

readingString:String [optional] - The original text typed into the IME before the user started picking candidates.

Example

The following example shows how to add a listener object with the callback method onIMEComposition() to System.IME, which outputs notification 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.addListener(IMEListener);
trace(System.IME.length);

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 a listener.";

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

See also

addListener (IME.addListener method), setCompositionString (IME.setCompositionString 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/00001742.html