User Guide

IME class 441
tf.text = "Current conversion mode is Japananese Hiragana.";
break;
case IMEConversionMode.JAPANESE_KATAKANA_FULL:
tf.text = "Current conversion mode is Japanese Katakana (full-
width).";
break;
case IMEConversionMode.JAPANESE_KATAKANA_HALF:
tf.text = "Current conversion mode is Japanese Katakana (half-
width).";
break;
case IMEConversionMode.KOREAN:
tf.text = "Current conversion mode is Korean.";
break;
default:
tf.text = "Current conversion mode is " + IME.conversionMode + ".";
break;
}
}
else
{
tf.text = "Please install an IME and try again.";
}
The previous code first checks to see whether the user has an IME installed. Next it checks
which conversion mode the current IME is using by comparing the
IME.conversionMode
property against each of the constants in the IMEConversionMode class.
Setting the IME conversion mode
When you change the conversion mode of the user’s IME, you need to make sure that the
code is wrapped in a
try..catch block, because setting a conversion mode using the
conversionMode property can throw an error if the IME is unable to set the conversion
mode. The following code demonstrates how to use a
try..catch block when setting the
IME.conversionMode property:
var statusText:TextField = new TextField;
statusText.autoSize = TextFieldAutoSize.LEFT;
addChild(statusText);
if (Capabilities.hasIME)
{
try
{
IME.enabled = true;
IME.conversionMode = IMEConversionMode.KOREAN;
statusText.text = "Conversion mode is " + IME.conversionMode + ".";
}
catch (error:Error)
{