MACROMEDIA FLASH MX 2004-USING COMPONENTS Use Manual page 743

Using components
Hide thumbs Also See for FLASH MX 2004-USING COMPONENTS:
Table of Contents

Advertisement

You can write ActionScript to control these and additional options for the TextInput component
using its properties, methods, and events. For more information, see
on page
745.
Creating an application with the TextInput component
The following procedure explains how to add a TextInput component to an application while
authoring. In this example, the component is a password field with an event listener that
determines if the proper number of characters has been entered.
To create an application with the TextInput component:
Drag a TextInput component from the Components panel to the Stage.
1.
In the Property inspector, do the following:
2.
Enter the instance name passwordField.
Leave the text parameter blank.
Set the editable parameter to
Set the password parameter to
Select Frame 1 in the Timeline, open the Actions panel, and enter the following code:
3.
textListener = new Object();
textListener.handleEvent = function (evt){
if (evt.type == "enter"){
trace("You must enter at least 8 characters");
}
}
passwordField.addEventListener("enter", textListener);
This code sets up an
that the user entered the proper number of characters.
Once text is entered in the passwordField instance, you can get its value as follows:
4.
var login = passwordField.text;
Customizing the TextInput component
You can transform a TextInput component horizontally while authoring and at runtime. While
authoring, select the component on the Stage and use the Free Transform tool or any of the
Modify > Transform commands. At runtime, use
properties and methods of the
When a TextInput component is resized, the border is resized to the new bounding box. The
TextInput component doesn't use scroll bars, but the insertion point scrolls automatically as the
user interacts with the text. The text field is then resized within the remaining area; there are no
fixed-size elements in a TextInput component. If the TextInput component is too small to display
the text, the text is clipped.
.
true
.
true
event handler on the TextInput passwordField instance that verifies
enter
TextInput
class.
"TextInput class"
UIObject.setSize()
TextInput component
or any applicable
743

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx

Table of Contents