
TextField._visible Property
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Alphabetical Language Reference
|
879
TextField.variable Property
associates a variable with the text property
Flash 6
read/write
theField.variable
Description
The string variable property is a backward-compatibility feature that specifies a regular
variable whose value will mirror the value of
theField.text. This allows for direct Flash 5–
style assignment of a value to a text field. The following example creates a text field object
with an instance name of
firstName_txt and associates it with the variable userName. Subse-
quent assignments to
userName are displayed in firstName_txt and reflected by its text
property.
this.createTextField("firstName_txt", 1, 0, 0, 200, 20);
firstName_txt.variable = "userName";
// Displays "Colin" on screen
userName = "Colin";
// Check the text property
trace(firstName_txt.text); // Displays: Colin
Conversely, assignments to firstName_txt.text are reflected by the variable userName:
firstName_txt.text = "Bruce";
trace(userName); // Displays: Bruce
The variable reference can be constructed with dot notation, allowing variables on objects
and other timelines to be used:
firstName_txt.variable = "_level0.someClip.someVariable";
When exporting to Flash 5 and prior versions, the variable property must be set in the
Flash MX authoring tool, in ...