456
Working with Text and Strings
3.
Select Control > Test Movie to test the document.
A message appears in the Output panel stating whether you have an IME installed and
currently active.
You can also use the IME class to enable and disable the IME in Flash at runtime. The
following example requires that you have an IME installed on your system. For more
information on installing an IME on your specific platform, see the following links:
■
www.microsoft.com/globaldev/default.mspx
■
http://developer.apple.com/documentation/
■
http://java.sun.com
You can enable and disable an IME while the SWF file plays, as shown in the following
example.
To enable and disable an input method editor at runtime:
1.
Create a new Flash document and save it as
ime2.fla
.
2.
Create two button symbol instances on the Stage and give them the instance names
enable_btn
and
disable_btn
.
3.
Add the following ActionScript to Frame 1 of the main Timeline:
checkIME();
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "_sans";
this.createTextField("ime_txt", 10, 100, 10, 320, 240);
ime_txt.border = true;
ime_txt.multiline = true;
ime_txt.setNewTextFormat(my_fmt);
ime_txt.type = "input";
ime_txt.wordWrap = true;
enable_btn.onRelease = function() {
System.IME.setEnabled(true);
};
disable_btn.onRelease = function() {
System.IME.setEnabled(false);
};
function checkIME():Boolean {
if (System.capabilities.hasIME) {
if (System.IME.getEnabled()) {
trace("You have an IME installed and enabled.");
return true;
} else {
trace("You have an IME installed but not enabled.");
Summary of Contents for FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Page 1: ...Learning ActionScript 2 0 in Flash...
Page 8: ...8 Contents...
Page 18: ...18 Introduction...
Page 30: ...30 What s New in Flash 8 ActionScript...
Page 66: ...66 Writing and Editing ActionScript 2 0...
Page 328: ...328 Interfaces...
Page 350: ...350 Handling Events...
Page 590: ...590 Creating Interaction with ActionScript...
Page 710: ...710 Understanding Security...
Page 730: ...730 Debugging Applications...
Page 780: ...780 Deprecated Flash 4 operators...
Page 830: ...830 Index...