29.04.2013 Views

ACTIONSCRIPT 3.0

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ACTIONSCRIPT</strong> <strong>3.0</strong> DEVELOPER’S GUIDE<br />

Keyboard input<br />

Note: If an IME is not active on the user's computer, calls to IME methods or properties, other than<br />

Capabilities.hasIME, will fail. Once you manually activate an IME, subsequent ActionScript calls to IME methods<br />

and properties will work as expected. For example, if you are using a Japanese IME, you must activate it before you can<br />

call any IME method or property.<br />

Checking if an IME is installed and enabled<br />

Flash Player 9 and later, Adobe AIR 1.0 and later<br />

Before you call any of the IME methods or properties, you should always check to see if the user’s computer currently<br />

has an IME installed and enabled. The following code illustrates how to check that the user has an IME both installed<br />

and active before you call any methods:<br />

if (Capabilities.hasIME)<br />

{<br />

if (IME.enabled)<br />

{<br />

trace("IME is installed and enabled.");<br />

}<br />

else<br />

{<br />

trace("IME is installed but not enabled. Please enable your IME and try again.");<br />

}<br />

}<br />

else<br />

{<br />

trace("IME is not installed. Please install an IME and try again.");<br />

}<br />

The previous code first checks to see if the user has an IME installed using the Capabilities.hasIME property. If this<br />

property is set to true, the code then checks whether the user’s IME is currently enabled, using the IME.enabled<br />

property.<br />

Determining which IME conversion mode is currently enabled<br />

Flash Player 9 and later, Adobe AIR 1.0 and later<br />

When building multilingual applications, you may need to determine which conversion mode the user currently has<br />

active. The following code demonstrates how to check whether the user has an IME installed, and if so, which IME<br />

conversion mode is currently active:<br />

Last updated 4/22/2013<br />

563

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!