03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Example<br />

The following example allows only uppercase characters, spaces, <strong>and</strong> numbers to be entered<br />

into a text field:<br />

my_txt.restrict = "A-Z 0-9";<br />

The following example includes all characters, but excludes lowercase letters:<br />

my_txt.restrict = "^a-z";<br />

You can use a backslash to enter a ^ or - verbatim. The accepted backslash sequences are \-, \^<br />

or \\. The backslash must be an actual character in the string, so when specified in<br />

<strong>ActionScript</strong>, a double backslash must be used. For example, the following code includes only<br />

the dash (-) <strong>and</strong> caret (^):<br />

my_txt.restrict = "\\-\\^";<br />

The ^ may be used anywhere in the string to toggle between including characters <strong>and</strong><br />

excluding characters. The following code includes only uppercase letters, but excludes the<br />

uppercase letter Q:<br />

my_txt.restrict = "A-Z^Q";<br />

You can use the \u escape sequence to construct restrict strings. The following code<br />

includes only the characters from ASCII 32 (space) to ASCII 126 (tilde).<br />

my_txt.restrict = "\u0020-\u007E";<br />

_rotation (TextField._rotation property)<br />

public _rotation : Number<br />

The rotation of the text field, in degrees, from its original orientation. Values from 0 to 180<br />

represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation.<br />

Values outside this range are added to or subtracted from 360 to obtain a value within the<br />

range. For example, the statement my_txt._rotation = 450 is the same as<br />

my_txt._rotation = 90.<br />

Rotation values are not supported for text fields that use device fonts. You must use embedded<br />

fonts to use _rotation with a text field.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 6<br />

Example<br />

In this example, you need to create a dynamic text field called my_txt, <strong>and</strong> then use the<br />

following <strong>ActionScript</strong> to embed fonts <strong>and</strong> rotate the text field. The reference to my font<br />

refers to a Font symbol in the library, with linkage set to my font.<br />

var my_fmt:TextFormat = new TextFormat();<br />

my_fmt.font = "my font";<br />

1224 <strong>ActionScript</strong> classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!