Flash CS3 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > IME (System.IME) > addListener (IME.addListener method) | |||
public static addListener(listener:Object) : Void
Registers an object to receive notification when an IME event handler is invoked by the onIMEComposition event.
Availability: ActionScript 1.0; Flash Player 8
listener:Object - An object, with an onIMEComposition (readingString) method, that listens for a callback notification from the IME event handlers. The reading string passed to this method is in the composition mode of the IME. For example, if the user enters text in Hiragana and then selects a Kanji candidate, the reading string is the original Hiragana.
The following example shows how to add a listener object to System.IME that 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);
}
}
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/00001731.html