About strings and the String class
457
return false;
}
} else {
trace("Please install an IME and try again.");
return false;
}
}
The preceding code is separated into five sections. The first section calls the
checkIME()
method, which displays a message in the Output panel if the system has an IME installed
or active. The second section defines a custom text-format object, which sets the font to
_sans
. The third section creates an input text field and applies the custom text format.
The fourth section creates some event handlers for the
enable_btn
and
disable_btn
instances created in an earlier step. The fifth, and final, section of code defines the custom
checkIME()
function, which checks whether the current system has an IME installed and
if so, whether or not the IME is active.
4.
Save the FLA file and select Control > Test Movie to test the document.
Type some text into the input text field on the Stage. Switch your IME to a different
language and type in the input text field again. Flash Player inputs characters by using the
new IME. If you click the
disable_btn
button on the Stage, Flash reverts to using the
previous language and ignores the current IME settings.
For information on
System.capabilities.hasIME
, see
hasIME (capabilities.hasIME
property)
in the
ActionScript 2.0 Language Reference
.
About the String class
A string is also a class and data type in the core ActionScript language. The String data type
represents a sequence of 16-bit characters that might include letters, numbers, and
punctuation marks. Strings are stored as Unicode characters, using the UTF-16 format. An
operation on a String value returns a new instance of the string. The default value for a
variable declared with the String data type is
null
.
For more information on strings, data, and values, see
Chapter 4, “Data and Data Types.”
The String class contains methods that let you work with text strings. Strings are important in
working with many objects, and the methods described in this chapter are useful in working
with strings used in many objects, such as TextField, XML, ContextMenu, and FileReference
instances.
NO
TE
This example requires that you have an IME installed on your system. For information
on installing an IME, see the links that precede this example.
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...