Restrict (Textfield.restrict Property) - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

Example
The following example creates a text field called
to the field. The
indexOf()
symbol (
). If the symbol is found, the specified text (between the index of 0 and the symbol)
@
replaces with the string
Output panel.
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.");
}
If your SWF file includes a version 2 component, use the version 2 components
DepthManager class instead of the
used in this example.

restrict (TextField.restrict property)

public restrict : String
Indicates the set of characters that a user may enter into the text field. If the value of the
property is
restrict
is an empty string, you cannot enter any character. If the value of the
string of 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.
Availability: ActionScript 1.0; Flash Player 6
method is used to find the first occurrence of the specified
. If the symbol is not found, an error message is displayed in the
bird
MovieClip.getNextHighestDepth()
, you can enter any character. If the value of the
null
and assigns the text
my_txt
dog@house.net
method, which is
property
restrict
property is a
restrict
TextField
1203

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

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

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF