User Guide
IME class 443
{
if (Capabilities.hasIME)
{
IME.enabled = true;
}
}
This example creates two input text fields, phoneTxt and nameTxt, and then adds two event
listeners to the
phoneTxt text field. When the user sets focus to the phoneTxt text field, a
FocusEvent.FOCUS_IN event is dispatched and the IME is disabled. When the phoneTxt text
field loses focus, the
FocusEvent.FOCUS_OUT event is dispatched to re-enable the IME.
Listening for IME composition events
IME composition events are dispatched when a composition string is being set. For example,
if the user has their IME enabled and active and types a string in Japanese, the
IMEEvent.IME_COMPOSITION event would dispatch as soon as the user selects the
composition string. In order to listen for the
IMEEvent.IME_COMPOSITION event, you need to
add an event listener to the static
ime property in the System class
(
flash.system.System.ime.addEventListener(...)), as shown in the following
example:
var inputTxt:TextField;
var outputTxt:TextField;
inputTxt = new TextField();
inputTxt.type = TextFieldType.INPUT;
inputTxt.width = 200;
inputTxt.height = 18;
inputTxt.border = true;
inputTxt.background = true;
addChild(inputTxt);
outputTxt = new TextField();
outputTxt.autoSize = TextFieldAutoSize.LEFT;
outputTxt.y = 20;
addChild(outputTxt);
if (Capabilities.hasIME)
{
IME.enabled = true;
try
{
IME.conversionMode = IMEConversionMode.JAPANESE_HIRAGANA;
}
catch (error:Error)
{