13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>ACTIONSCRIPT</strong> 3.0 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, subsequ<strong>en</strong>t 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 <strong>en</strong>abled<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 curr<strong>en</strong>tly<br />

has an IME installed and <strong>en</strong>abled. 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.<strong>en</strong>abled)<br />

{<br />

trace("IME is installed and <strong>en</strong>abled.");<br />

}<br />

else<br />

{<br />

trace("IME is installed but not <strong>en</strong>abled. Please <strong>en</strong>able 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 th<strong>en</strong> checks whether the user’s IME is curr<strong>en</strong>tly <strong>en</strong>abled, using the IME.<strong>en</strong>abled<br />

property.<br />

Determining which IME conversion mode is curr<strong>en</strong>tly <strong>en</strong>abled<br />

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

Wh<strong>en</strong> building multilingual applications, you may need to determine which conversion mode the user curr<strong>en</strong>tly 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 curr<strong>en</strong>tly active:<br />

Last updated 6/6/2012<br />

562

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

Saved successfully!

Ooh no, something went wrong!