MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference page 745

Actionscript language reference
Table of Contents

Advertisement

Description
Method; replaces a range of characters, specified by the
the specified text field with the contents of the
Example
The following example creates a text field called
the field. The
indexOf()
If the symbol is found, the specified text (between the index of 0 and the symbol) replaces with
the string
. If the symbol is not found, an error message writes to the log file.
bird
this.createTextField("my_txt", this.getNextHighestDepth(), 10, 10, 320, 22);
my_txt.autoSize = true;
my_txt.text = "dog@house.net";
var symbol:String = "@";
var symbolPos:Number = my_txt.text.indexOf(symbol);
if (symbolPos>-1) {
my_txt.replaceText(0, symbolPos, "bird");
} else {
trace("symbol '"+symbol+"' not found.");
}
TextField.restrict
Availability
Flash Player 6.
Usage
my_txt.restrict:String
Description
Property; indicates the set of characters that a user may enter into the text field. If the value of the
property is
restrict
an empty string, you can't enter any character. If the value of the
characters, you can enter only characters in the string into the text field. The string is scanned
from left to right. A range may be specified using the dash (-). This only restricts user interaction;
a script may put any text into the text field. This property does not synchronize with the Embed
Font Outlines check boxes in the Property inspector.
If the string begins with ^, all characters are initially accepted and succeeding characters in the
string are excluded from the set of accepted characters. If the string does not begin with ^, no
characters are initially accepted and succeeding characters in the string are included in the set of
accepted characters.
Example
The following example allows only uppercase characters, spaces, and numbers to be entered into
a text field:
my_txt.restrict = "A-Z 0-9";
method is used to find the first occurrence of the specified symbol (
, you can enter any character. If the value of the
null
and
beginIndex
parameter.
text
and assigns the text dog@house.net to
my_txt
restrict
parameters, in
endIndex
property is
restrict
property is a string of
TextField.restrict
745
).
@

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flex

Table of Contents