alwaysShowSelection:Boolean
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
When set to true
and the text field is not in focus, Flash Player highlights the
selection in the text field in gray. When set to false
and the text field is not in
focus, Flash Player does not highlight the selection in the text field.
Implementation public function get alwaysShowSelection():Boolean
public function set alwaysShowSelection(value:Boolean):void
antiAliasType:String
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
The type of anti-aliasing used for this text field. Use flash.text.AntiAliasType
constants for this property. You can control this setting only if the font is
embedded (with the embedFonts
property set to true
).
The default setting is flash.text.AntiAliasType.NORMAL
.
To set values for this property, use the following string values:
String value | Description |
---|
flash.text.AntiAliasType.NORMAL | Applies the regular text anti-aliasing. This value matches the type of anti-aliasing that
Flash Player 7 and earlier versions used. |
flash.text.AntiAliasType.ADVANCED | Applies advanced anti-aliasing, which makes text more legible. (This feature became
available in Flash Player 8.) Advanced anti-aliasing allows for high-quality rendering
of font faces at small sizes. It is best used with applications
with a lot of small text. Advanced anti-aliasing is not recommended for
fonts that are larger than 48 points. |
Implementation public function get antiAliasType():String
public function set antiAliasType(value:String):void
autoSize:String
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Controls automatic sizing and alignment of text fields.
Acceptable values for the TextFieldAutoSize
constants: TextFieldAutoSize.NONE
(the default),
TextFieldAutoSize.LEFT
, TextFieldAutoSize.RIGHT
, and TextFieldAutoSize.CENTER
.
If autoSize
is set to TextFieldAutoSize.NONE
(the default) no resizing occurs.
If autoSize
is set to TextFieldAutoSize.LEFT
, the text is
treated as left-justified text, meaning that the left margin of the text field remains fixed and any
resizing of a single line of the text field is on the right margin. If the text includes a line break
(for example, "\n"
or "\r"
), the bottom is also resized to fit the next
line of text. If wordWrap
is also set to true
, only the bottom
of the text field is resized and the right side remains fixed.
If autoSize
is set to TextFieldAutoSize.RIGHT
, the text is treated as
right-justified text, meaning that the right margin of the text field remains fixed and any resizing
of a single line of the text field is on the left margin. If the text includes a line break
(for example, "\n" or "\r")
, the bottom is also resized to fit the next
line of text. If wordWrap
is also set to true
, only the bottom
of the text field is resized and the left side remains fixed.
If autoSize
is set to TextFieldAutoSize.CENTER
, the text is treated as
center-justified text, meaning that any resizing of a single line of the text field is equally distributed
to both the right and left margins. If the text includes a line break (for example, "\n"
or
"\r"
), the bottom is also resized to fit the next line of text. If wordWrap
is also
set to true
, only the bottom of the text field is resized and the left and
right sides remain fixed.
Implementation public function get autoSize():String
public function set autoSize(value:String):void
background:Boolean
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Specifies whether the text field has a background fill. If true
, the text field has a
background fill. If false
, the text field has no background fill.
Use the backgroundColor
property to set the background color of a text field.
Implementation public function get background():Boolean
public function set background(value:Boolean):void
backgroundColor:uint
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
The color of the text field background. The default value is 0xFFFFFF
(white).
This property can be retrieved or set, even if there currently is no background, but the
color is visible only if the text field has the background
property set to
true
.
Implementation public function get backgroundColor():uint
public function set backgroundColor(value:uint):void
border:Boolean
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Specifies whether the text field has a border. If true
, the text field has a border.
If false
, the text field has no border. Use the borderColor
property
to set the border color.
Implementation public function get border():Boolean
public function set border(value:Boolean):void
borderColor:uint
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
The color of the text field border. The default value is 0x000000
(black).
This property can be retrieved or set, even if there currently is no border, but the
color is visible only if the text field has the border
property set to
true
.
Implementation public function get borderColor():uint
public function set borderColor(value:uint):void
bottomScrollV:int
[read-only]
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
An integer (1-based index) that indicates the bottommost line that is currently visible in
the specified text field. Think of the text field as a window onto a block of text.
The scrollV
property is the 1-based index of the topmost visible line
in the window.
All the text between the lines indicated by scrollV
and bottomScrollV
is currently visible in the text field.
Implementation public function get bottomScrollV():int
caretIndex:int
[read-only]
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
The index of the insertion point (caret) position. If no insertion point is displayed,
the value is the position the insertion point would be if you restored focus to the field (typically where the
insertion point last was, or 0 if the field has not had focus).
Selection span indexes are zero-based (for example, the first position is 0,
the second position is 1, and so on).
Implementation public function get caretIndex():int
condenseWhite:Boolean
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
A Boolean value that specifies whether extra white space (spaces, line breaks, and so on)
in a text field with HTML text is removed. The default value is false
.
The condenseWhite
property only affects text set with
the htmlText
property, not the text
property. If you set
text with the text
property, condenseWhite
is ignored.
If condenseWhite
is set to true
, use standard HTML commands such as
<BR>
and <P>
to place line breaks in the text field.
Set the condenseWhite
property before setting the htmlText
property.
Implementation public function get condenseWhite():Boolean
public function set condenseWhite(value:Boolean):void
defaultTextFormat:flash.text:TextFormat
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Specifies the format applied to newly inserted text, such as text entered by a user or text inserted with the
replaceSelectedText()
method.
Note: When selecting characters to be replaced with setSelection()
and
replaceSelectedText()
, the defaultTextFormat
will be applied only if the
text has been selected up to and including the last character. Here is an example:
var my_txt:TextField new TextField();
my_txt.text = "Flash Macintosh version";
var my_fmt:TextFormat = new TextFormat();
my_fmt.color = 0xFF0000;
my_txt.defaultTextFormat = my_fmt;
my_txt.setSelection(6,15); // partial text selected - defaultTextFormat not applied
my_txt.setSelection(6,23); // text selected to end - defaultTextFormat applied
my_txt.replaceSelectedText("Windows version");
When you access the defaultTextFormat
property, the returned TextFormat object has all
of its properties defined. No property is null
.
Note: You can't set this property if a style sheet is applied to the text field.
Implementation public function get defaultTextFormat():flash.text:TextFormat
public function set defaultTextFormat(value:flash.text:TextFormat):void
displayAsPassword:Boolean
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Specifies whether the text field is a password text field. If the value of this property is true
,
the text field is treated as a password text field and hides the input characters using asterisks instead of the
actual characters. If false
, the text field is not treated as a password text field. When password mode
is enabled, the Cut and Copy commands and their corresponding keyboard shortcuts will
not function. This security mechanism prevents an unscrupulous user from using the shortcuts to discover
a password on an unattended computer.
Implementation public function get displayAsPassword():Boolean
public function set displayAsPassword(value:Boolean):void
doubleClickEnabled:Boolean
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Specifies whether the object receives doubleClick
events. The default value
is false
, which means that by default an InteractiveObject instance does not receive
doubleClick
events. If the doubleClickEnabled
property is set to
true
, the instance receives doubleClick
events within its bounds.
The mouseEnabled
property of the InteractiveObject instance must also be
set to true
for the object to receive doubleClick
events.
No event is dispatched by setting this property. You must use the
addEventListener()
method to add an event listener
for the doubleClick
event.
Implementation public function get doubleClickEnabled():Boolean
public function set doubleClickEnabled(value:Boolean):void
embedFonts:Boolean
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Specifies whether to render by using embedded font outlines.
If false
, Flash Player renders the text field by using
device fonts.
If you set the embedFonts
property to true
for a text field,
you must specify a font for that text by using the font
property of
a TextFormat object applied to the text field.
If the specified font is not embedded in the SWF file, the text is not displayed.
Implementation public function get embedFonts():Boolean
public function set embedFonts(value:Boolean):void
focusRect:Object
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Specifies whether this object displays a focus rectangle. It can take one of three
values: true
, false
, or null
. Values of true
and false
work as expected, specifying whether or not the focus rectangle
appears. A value of null
indicates that this object obeys the
stageFocusRect
property of the Stage.
Implementation public function get focusRect():Object
public function set focusRect(value:Object):void
gridFitType:String
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
The type of grid fitting used for this text field. This property applies only if the
flash.text.AntiAliasType
property of the text field is set to flash.text.AntiAliasType.ADVANCED
.
The type of grid fitting used determines whether Flash Player forces strong horizontal and
vertical lines to fit to a pixel or subpixel grid, or not at all.
For the flash.text.GridFitType
property, you can use the following string values:
String value | Description |
---|
flash.text.GridFitType.NONE | Specifies no grid fitting. Horizontal and vertical lines in the glyphs are not
forced to the pixel grid. This setting is recommended for animation or
for large font sizes. |
flash.text.GridFitType.PIXEL | Specifies that strong horizontal and vertical lines are fit to the
pixel grid. This setting works only for left-aligned text fields.
To use this setting, the flash.dispaly.AntiAliasType property of the text field
must be set to flash.text.AntiAliasType.ADVANCED .
This setting generally provides the best legibility for
left-aligned text. |
flash.text.GridFitType.SUBPIXEL | Specifies that strong horizontal and vertical lines are fit to the subpixel grid on
an LCD monitor. To use this setting, the
flash.text.AntiAliasType property of the text field must be set to
flash.text.AntiAliasType.ADVANCED . The flash.text.GridFitType.SUBPIXEL setting is often good
for right-aligned or centered
dynamic text, and it is sometimes a useful trade-off for animation versus text quality. |
Implementation public function get gridFitType():String
public function set gridFitType(value:String):void
htmlText:String
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Contains the HTML representation of the text field contents.
Flash Player supports the following HTML tags:
Tag
|
Description
|
---|
Anchor tag
|
The <a> tag creates a hypertext link and supports the following attributes:
-
target : Specifies the name of the target window where you load the page.
Options include _self , _blank , _parent , and
_top . The _self option specifies the current frame in the current window,
_blank specifies a new window, _parent specifies the parent of the
current frame, and _top specifies the top-level frame in the current window.
-
href : Specifies a URL or an ActionScript link event.The URL can
be either absolute or relative to the location of the SWF file that
is loading the page. An example of an absolute reference to a URL is
http://www.adobe.com ; an example of a relative reference is
/index.html . Absolute URLs must be prefixed with
http://; otherwise, Flash Player or AIR treats them as relative URLs.
You can use the link event to cause the link to execute an ActionScript
function in a SWF file instead of opening a URL. To specify a link event, use
the event scheme instead of the http scheme in your href attribute. An example
is href="event:myText" instead of href="http://myURL" ; when the
user clicks a hypertext link that contains the event scheme, the text field dispatches a
link TextEvent with its text property set to "myText ". You can then create an ActionScript
function that executes whenever the link TextEvent is dispatched.
You can also define a:link , a:hover , and a:active
styles for anchor tags by using style sheets.
|
Bold tag
|
The <b> tag renders text as bold. A bold typeface must be available for the font used.
|
Break tag
|
The <br> tag creates a line break in the text field. Set the text field to
be a multiline text field to use this tag.
|
Font tag
|
The <font> tag specifies a font or list of fonts to display the text.The font tag
supports the following attributes:
-
color : Only hexadecimal color (#FFFFFF ) values are supported.
-
face : Specifies the name of the font to use. As shown in the following example,
you can specify a list of comma-delimited font names, in which case Flash Player selects the first available
font. If the specified font is not installed on the local computer system or isn't embedded in the SWF file,
Flash Player selects a substitute font.
-
size : Specifies the size of the font. You can use absolute pixel sizes, such as 16 or 18,
or relative point sizes, such as +2 or -4.
|
Image tag
|
The <img> tag lets you embed external image files (JPEG, GIF, PNG), SWF files, and
movie clips inside text fields. Text automatically flows around images you embed in text fields. You
must set the text field to be multiline to wrap text around an image.
The <img> tag supports the following attributes:
-
src : Specifies the URL to an image or SWF file, or the linkage identifier for a movie clip
symbol in the library. This attribute is required; all other attributes are optional. External files (JPEG, GIF, PNG,
and SWF files) do not show until they are downloaded completely.
-
width : The width of the image, SWF file, or movie clip being inserted, in pixels.
-
height : The height of the image, SWF file, or movie clip being inserted, in pixels.
-
align : Specifies the horizontal alignment of the embedded image within the text field.
Valid values are left and right . The default value is left .
-
hspace : Specifies the amount of horizontal space that surrounds the image where
no text appears. The default value is 8.
-
vspace : Specifies the amount of vertical space that surrounds the image where no
text appears. The default value is 8.
-
id : Specifies the name for the movie clip instance (created by Flash Player) that contains
the embedded image file, SWF file, or movie clip. This approach is used to control the embedded content with
ActionScript.
-
checkPolicyFile : Specifies that Flash Player checks for a URL policy file
on the server associated with the image domain. If a policy file exists, SWF files in the domains
listed in the file can access the data of the loaded image, for example, by calling the
BitmapData.draw() method with this image as the source parameter. For more information,
see the "Flash Player Security" chapter in Programming ActionScript 3.0.
Flash displays media embedded in a text field at full size. To specify the dimensions of the media
you are embedding, use the <img> tag height and width
attributes.
In general, an image embedded in a text field appears on the line following the
<img> tag. However, when the <img> tag
is the first character in the text field, the image appears on the first line of the text field.
For AIR content in the application security sandbox, AIR ignores img tags in
HTML content in ActionScript TextField objects. This is to prevent possible phishing attacks,
|
Italic tag
|
The <i> tag displays the tagged text in italics. An italic typeface must be available
for the font used.
|
List item tag
|
The <li> tag places a bullet in front of the text that it encloses.
Note: Because Flash Player and AIR do not recognize ordered and unordered list tags (<ol>
and <ul> , they do not modify how your list is rendered. All lists are unordered and all
list items use bullets.
|
Paragraph tag
|
The <p> tag creates a new paragraph. The text field must be set to be a multiline
text field to use this tag.
The <p> tag supports the following attributes:
-
align: Specifies alignment of text within the paragraph; valid values are
left , right , justify , and center .
-
class: Specifies a CSS style class defined by a flash.text.StyleSheet object.
|
Span tag
|
The <span> tag is available only for use with CSS text styles. It supports the
following attribute:
-
class: Specifies a CSS style class defined by a flash.text.StyleSheet object.
|
Text format tag
|
The <textformat> tag lets you use a subset of paragraph formatting
properties of the TextFormat class within text fields, including line leading, indentation,
margins, and tab stops. You can combine <textformat> tags with the
built-in HTML tags.
The <textformat> tag has the following attributes:
-
blockindent : Specifies the block indentation in points; corresponds to
TextFormat.blockIndent .
-
indent : Specifies the indentation from the left margin to the first character
in the paragraph; corresponds to TextFormat.indent . Both positive and negative
numbers are acceptable.
-
leading : Specifies the amount of leading (vertical space) between lines;
corresponds to TextFormat.leading . Both positive and negative numbers are acceptable.
-
leftmargin : Specifies the left margin of the paragraph, in points; corresponds
to TextFormat.leftMargin .
-
rightmargin : Specifies the right margin of the paragraph, in points; corresponds
to TextFormat.rightMargin .
-
tabstops : Specifies custom tab stops as an array of non-negative integers;
corresponds to TextFormat.tabStops .
|
Underline tag
|
The <u> tag underlines the tagged text.
|
Flash Player and AIR support the following HTML entities:
Entity
|
Description
|
---|
<
|
< (less than)
|
>
|
> (greater than)
|
&
|
& (ampersand)
|
"
|
" (double quotes)
|
'
|
' (apostrophe, single quote)
|
Flash Player and AIR also support explicit character codes, such as
& (ASCII ampersand) and € (Unicode € symbol).
Implementation public function get htmlText():String
public function set htmlText(value:String):void
ignorePadding:Boolean
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
If true
, the paddingLeft
and
paddingRight
styles will not add space
around the text of the component.
Implementation public function get ignorePadding():Boolean
public function set ignorePadding(value:Boolean):void
inheritingStyles:Object
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
The beginning of this UITextField's chain of inheriting styles.
The getStyle()
method accesses
inheritingStyles[styleName]
to search the entire
prototype-linked chain.
This object is set up by the initProtoChain()
method.
You typically never need to access this property directly.
Implementation public function get inheritingStyles():Object
public function set inheritingStyles(value:Object):void
length:int
[read-only]
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
The number of characters in a text field. A character such as tab (\t
) counts as one
character.
Implementation public function get length():int
maxChars:int
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
The maximum number of characters that the text field can contain, as entered by a user.
A script can insert more text than maxChars
allows; the maxChars
property
indicates only how much text a user can enter. If the value of this property is 0
,
a user can enter an unlimited amount of text.
Implementation public function get maxChars():int
public function set maxChars(value:int):void
maxScrollH:int
[read-only]
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
The maximum value of scrollH
.
Implementation public function get maxScrollH():int
maxScrollV:int
[read-only]
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
The maximum value of scrollV
.
Implementation public function get maxScrollV():int
mouseEnabled:Boolean
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Specifies whether this object receives mouse messages. The default value is true
,
which means that by default any InteractiveObject instance that is on the display list
receives mouse events.
If mouseEnabled
is set to false
, the instance does not receive any
mouse events. Any children of this instance on the display list are not affected. To change
the mouseEnabled
behavior for all children of an object on the display list, use
flash.display.DisplayObjectContainer.mouseChildren
.
No event is dispatched by setting this property. You must use the
addEventListener()
method to create interactive functionality.
Implementation public function get mouseEnabled():Boolean
public function set mouseEnabled(value:Boolean):void
mouseWheelEnabled:Boolean
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
A Boolean value that indicates whether Flash Player automatically scrolls multiline
text fields when the user clicks a text field and rolls the mouse wheel.
By default, this value is true
. This property is useful if you want to prevent
mouse wheel scrolling of text fields, or implement your own text field scrolling.
Implementation public function get mouseWheelEnabled():Boolean
public function set mouseWheelEnabled(value:Boolean):void
multiline:Boolean
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Indicates whether field is a multiline text field. If the value is true
,
the text field is multiline; if the value is false
, the text field is a single-line
text field. In a field of type TextFieldType.INPUT
, the multiline
value
determines whether the Enter
key creates a new line (a value of false
,
and the Enter
key is ignored).
If you paste text into a TextField
with a multiline
value of false
,
newlines are stripped out of the text.
Implementation public function get multiline():Boolean
public function set multiline(value:Boolean):void
nestLevel:int
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Depth of this object in the containment hierarchy.
This number is used by the measurement and layout code.
The value is 0 if this component is not on the DisplayList.
Implementation public function get nestLevel():int
public function set nestLevel(value:int):void
nonInheritingStyles:Object
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
The beginning of this UITextField's chain of non-inheriting styles.
The getStyle()
method accesses
nonInheritingStyles[styleName]
method to search the entire
prototype-linked chain.
This object is set up by the initProtoChain()
method.
You typically never need to access this property directly.
Implementation public function get nonInheritingStyles():Object
public function set nonInheritingStyles(value:Object):void
nonZeroTextHeight:Number
[read-only]
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Unlike textHeight, this returns a non-zero value
even when the text is empty.
In this case, it returns what the textHeight would be
if the text weren't empty.
Implementation public function get nonZeroTextHeight():Number
numLines:int
[read-only]
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Defines the number of text lines in a multiline text field.
If wordWrap
property is set to true
,
the number of lines increases when text wraps.
Implementation public function get numLines():int
restrict:String
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Indicates the set of characters that a user can enter into the text field. If the value of the
restrict
property is null
, you can enter any character. If the value of
the restrict
property is an empty string, you cannot enter any character. If the value
of the restrict
property is a string of characters, you can enter only characters in
the string into the text field. The string is scanned from left to right. You can specify a range by
using the hyphen (-) character. Only user interaction is restricted; a script can put any text into the
text field.
If the string begins with a caret (^) character, 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 a caret (^) character, no characters are initially accepted and succeeding characters in the
string are included in the set of accepted characters.
The following example allows only uppercase characters, spaces, and numbers to be entered into
a text field:
my_txt.restrict = "A-Z 0-9";
The following example includes all characters, but excludes lowercase letters:
my_txt.restrict = "^a-z";
You can use a backslash to enter a ^ or - verbatim. The accepted backslash sequences are \-, \^ or \\.
The backslash must be an actual character in the string, so when specified in ActionScript, a double backslash
must be used. For example, the following code includes only the dash (-) and caret (^):
my_txt.restrict = "\\-\\^";
The ^ can be used anywhere in the string to toggle between including characters and excluding characters.
The following code includes only uppercase letters, but excludes the uppercase letter Q:
my_txt.restrict = "A-Z^Q";
You can use the \u
escape sequence to construct restrict
strings.
The following code includes only the characters from ASCII 32 (space) to ASCII 126 (tilde).
my_txt.restrict = "\u0020-\u007E";
Implementation public function get restrict():String
public function set restrict(value:String):void
scrollH:int
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
The current horizontal scrolling position. If the scrollH
property is 0, the text
is not horizontally scrolled. This property value is an integer that represents the horizontal
position in pixels.
The units of horizontal scrolling are pixels, whereas the units of vertical scrolling are lines.
Horizontal scrolling is measured in pixels because most fonts you typically use are proportionally
spaced; that is, the characters can have different widths. Flash Player performs vertical scrolling by
line because users usually want to see a complete line of text rather than a
partial line. Even if a line uses multiple fonts, the height of the line adjusts to fit
the largest font in use.
Note: The scrollH
property is zero-based, not 1-based like
the scrollV
vertical scrolling property.
Implementation public function get scrollH():int
public function set scrollH(value:int):void
scrollV:int
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
The vertical position of text in a text field. The scrollV
property is useful for
directing users to a specific paragraph in a long passage, or creating scrolling text fields.
The units of vertical scrolling are lines, whereas the units of horizontal scrolling are pixels.
If the first line displayed is the first line in the text field, scrollV is set to 1 (not 0).
Horizontal scrolling is measured in pixels because most fonts are proportionally
spaced; that is, the characters can have different widths. Flash performs vertical scrolling by line
because users usually want to see a complete line of text rather than a partial line.
Even if there are multiple fonts on a line, the height of the line adjusts to fit the largest font in
use.
Implementation public function get scrollV():int
public function set scrollV(value:int):void
selectable:Boolean
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
A Boolean value that indicates whether the text field is selectable. The value true
indicates that the text is selectable. The selectable
property controls whether
a text field is selectable, not whether a text field is editable. A dynamic text field can
be selectable even if it is not editable. If a dynamic text field is not selectable, the user
cannot select its text.
If selectable
is set to false
, the text in the text field does not
respond to selection commands from the mouse or keyboard, and the text cannot be copied with the
Copy command. If selectable
is set to true
, the text in the text field
can be selected with the mouse or keyboard, and the text can be copied with the Copy command.
You can select text this way even if the text field is a dynamic text field instead of an input text field.
Implementation public function get selectable():Boolean
public function set selectable(value:Boolean):void
selectionBeginIndex:int
[read-only]
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
The zero-based character index value of the first character in the current selection.
For example, the first character is 0, the second character is 1, and so on. If no
text is selected, this property is the value of caretIndex
.
Implementation public function get selectionBeginIndex():int
selectionEndIndex:int
[read-only]
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
The zero-based character index value of the last character in the current selection.
For example, the first character is 0, the second character is 1, and so on. If no
text is selected, this property is the value of caretIndex
.
Implementation public function get selectionEndIndex():int
sharpness:Number
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
The sharpness of the glyph edges in this text field. This property applies
only if the flash.text.AntiAliasType
property of the text field is set to
flash.text.AntiAliasType.ADVANCED
. The range for
sharpness
is a number from -400 to 400. If you attempt to set
sharpness
to a value outside that range, Flash sets the property to
the nearest value in the range (either -400 or 400).
Implementation public function get sharpness():Number
public function set sharpness(value:Number):void
styleSheet:StyleSheet
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Attaches a style sheet to the text field. For information on creating style sheets, see the StyleSheet class
and Programming ActionScript 3.0.
You can change the style sheet associated with a text field at any time. If you change
the style sheet in use, the text field is redrawn with the new style sheet.
You can set the style sheet to null
or undefined
to remove the style sheet. If the style sheet in use is removed, the text field is redrawn without a style sheet.
Note: If the style sheet is removed, the contents of both TextField.text
and
TextField.htmlText
change to incorporate the formatting previously applied by the style sheet. To preserve
the original TextField.htmlText
contents without the formatting, save the value in a variable before
removing the style sheet.
Implementation public function get styleSheet():StyleSheet
public function set styleSheet(value:StyleSheet):void
tabEnabled:Boolean
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Specifies whether this object is in the tab order. If this object is in the tab order,
the value is true
; otherwise, the value is false
. By default,
the value is false
, except for the following:
- For a SimpleButton object, the value is
true
. - For a TextField object with
type = "input"
, the value is true
. - For a Sprite object or MovieClip object with
buttonMode = true
, the value is true
.
Implementation public function get tabEnabled():Boolean
public function set tabEnabled(value:Boolean):void
tabIndex:int
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Specifies the tab ordering of objects in a SWF file. The tabIndex
property is -1 by default, meaning no tab index is set for the object.
If any currently displayed object in the SWF file contains a tabIndex
property, automatic
tab ordering is disabled, and the tab ordering is calculated from the tabIndex
properties of
objects in the SWF file. The custom tab ordering includes only objects that have tabIndex
properties.
The tabIndex
property can be a non-negative integer. The objects are ordered according to
their tabIndex
properties, in ascending order. An object with a tabIndex
value of 1 precedes an object with a tabIndex
value of 2. Do not use the same tabIndex
value for multiple objects.
The custom tab ordering that the tabIndex
property defines is flat.
This means that no attention is paid to the hierarchical relationships of objects in the SWF file.
All objects in the SWF file with tabIndex
properties are placed in the tab order, and the
tab order is determined by the order of the tabIndex
values.
Implementation public function get tabIndex():int
public function set tabIndex(value:int):void
text:String
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
A string that is the current text in the text field. Lines are separated by the carriage
return character ('\r'
, ASCII 13). This property contains unformatted text in the text
field, without HTML tags.
To get the text in HTML form, use the htmlText
property.
Implementation public function get text():String
public function set text(value:String):void
textColor:uint
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
The color of the text in a text field, in hexadecimal format.
The hexadecimal color system uses six digits to represent
color values. Each digit has 16 possible values or characters. The characters range from
0-9 and then A-F. For example, black is 0x000000
; white is
0xFFFFFF
.
Implementation public function get textColor():uint
public function set textColor(value:uint):void
textHeight:Number
[read-only]
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
The height of the text in pixels.
Implementation public function get textHeight():Number
textWidth:Number
[read-only]
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
The width of the text in pixels.
Implementation public function get textWidth():Number
thickness:Number
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
The thickness of the glyph edges in this text field. This property applies only
when flash.text.AntiAliasType
is set to flash.text.AntiAliasType.ADVANCED
.
The range for thickness
is a number from -200 to 200. If you attempt to
set thickness
to a value outside that range, the property is set to the
nearest value in the range (either -200 or 200).
Implementation public function get thickness():Number
public function set thickness(value:Number):void
type:String
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
The type of the text field.
Either one of the following TextFieldType constants: TextFieldType.DYNAMIC
,
which specifies a dynamic text field, which a user cannot edit, or TextFieldType.INPUT
,
which specifies an input text field, which a user can edit.
Implementation public function get type():String
public function set type(value:String):void
useRichTextClipboard:Boolean
Implementation public function get useRichTextClipboard():Boolean
public function set useRichTextClipboard(value:Boolean):void
wordWrap:Boolean
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
A Boolean value that indicates whether the text field has word wrap. If the value of
wordWrap
is true
, the text field has word wrap;
if the value is false
, the text field does not have word wrap. The default
value is false
.
Implementation public function get wordWrap():Boolean
public function set wordWrap(value:Boolean):void
public function appendText(newText:String):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Appends the string specified by the newText
parameter to the end of the text
of the text field. This method is more efficient than an addition assignment (+=
) on
a text
property (such as someTextField.text += moreText
),
particularly for a text field that contains a significant amount of content.
Parameters
| newText:String — The string to append to the existing text.
|
public function getCharBoundaries(charIndex:int):Rectangle
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Returns a rectangle that is the bounding box of the character.
Parameters
| charIndex:int — The zero-based index value for the character (for example, the first
position is 0, the second position is 1, and so on).
|
Returns | Rectangle — A rectangle with x and y minimum and maximum values
defining the bounding box of the character.
|
public function getCharIndexAtPoint(x:Number, y:Number):int
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Returns the zero-based index value of the character at the point specified by the x
and y
parameters.
Parameters
| x:Number — The x coordinate of the character.
|
|
| y:Number — The y coordinate of the character.
|
Returns | int — The zero-based index value of the character (for example, the first position is 0,
the second position is 1, and so on). Returns -1 if the point is not over any character.
|
public function getFirstCharInParagraph(charIndex:int):int
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Given a character index, returns the index of the first character in the same paragraph.
Parameters
| charIndex:int — The zero-based index value of the character (for example, the first character is 0,
the second character is 1, and so on).
|
Returns | int — The zero-based index value of the first character in the same paragraph.
|
public function getImageReference(id:String):DisplayObject
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Returns a DisplayObject reference for the given id
, for an image or SWF file
that has been added to an HTML-formatted text field by using an <img>
tag.
The <img>
tag is in the following format:
<img src = 'filename.jpg' id = 'instanceName' >
Parameters
| id:String — The id to match (in the id attribute of the
<img> tag).
|
Returns | DisplayObject — The display object corresponding to the image or SWF file with the matching id
attribute in the <img> tag of the text field. For media loaded from an external source,
this object is a Loader object, and, once loaded, the media object is a child of that Loader object. For media
embedded in the SWF file, it is the loaded object. If no <img> tag with
the matching id exists, the method returns null .
|
public function getLineIndexAtPoint(x:Number, y:Number):int
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Returns the zero-based index value of the line at the point specified by the x
and y
parameters.
Parameters
| x:Number — The x coordinate of the line.
|
|
| y:Number — The y coordinate of the line.
|
Returns | int — The zero-based index value of the line (for example, the first line is 0, the
second line is 1, and so on). Returns -1 if the point is not over any line.
|
public function getLineIndexOfChar(charIndex:int):int
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Returns the zero-based index value of the line containing the character specified
by the charIndex
parameter.
Parameters
| charIndex:int — The zero-based index value of the character (for example, the first character is 0,
the second character is 1, and so on).
|
Returns | int — The zero-based index value of the line.
|
public function getLineLength(lineIndex:int):int
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Returns the number of characters in a specific text line.
Parameters
| lineIndex:int — The line number for which you want the length.
|
Returns | int — The number of characters in the line.
|
public function getLineMetrics(lineIndex:int):flash.text:TextLineMetrics
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Returns metrics information about a given text line.
Parameters
| lineIndex:int — The line number for which you want metrics information.
|
Returns public function getLineOffset(lineIndex:int):int
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Returns the character index of the first character in the line that
the lineIndex
parameter specifies.
Parameters
| lineIndex:int — The zero-based index value of the line (for example, the first line is 0,
the second line is 1, and so on).
|
Returns | int — The zero-based index value of the first character in the line.
|
public function getLineText(lineIndex:int):String
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Returns the text of the line specified by the lineIndex
parameter.
Parameters
| lineIndex:int — The zero-based index value of the line (for example, the first line is 0,
the second line is 1, and so on).
|
Returns | String — The text string contained in the specified line.
|
public function getParagraphLength(charIndex:int):int
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Given a character index, returns the length of the paragraph containing the given character.
The length is relative to the first character in the paragraph (as returned by
getFirstCharInParagraph()
), not to the character index passed in.
Parameters
| charIndex:int — The zero-based index value of the character (for example, the first character is 0,
the second character is 1, and so on).
|
Returns | int — Returns the number of characters in the paragraph.
|
public function getStyle(styleProp:String):*
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Gets a style property that has been set anywhere in this
component's style lookup chain.
This same method is used to get any kind of style property,
so the value returned may be a Boolean, String, Number, int,
uint (for an RGB color), Class (for a skin), or any kind of object.
Therefore the return type is simply specified as *.
If you are getting a particular style property, you will
know its type and will often want to store the result in a
variable of that type.
No casting from * to that type is necessary.
var backgroundColor:uint = getStyle("backgroundColor");
If the style property has not been set anywhere in the
style lookup chain, the value returned by getStyle()
will be undefined
.
Note that undefined
is a special value that is
not the same as false
, ""
,
NaN
, 0
, or null
.
No valid style value is ever undefined
.
You can use the method
IStyleManager2.isValidStyleValue()
to test whether the value was set.
Parameters
| styleProp:String — Name of the style property.
|
Returns public function getTextFormat(beginIndex:int = -1, endIndex:int = -1):flash.text:TextFormat
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Returns a TextFormat object that contains formatting information for the range of text that the
beginIndex
and endIndex
parameters specify. Only properties
that are common to the entire text specified are set in the resulting TextFormat object.
Any property that is mixed, meaning that it has different values
at different points in the text, has a value of null
.
If you do not specify
values for these parameters, this method is applied to all the text in the text field.
The following table describes three possible usages:
Usage | Description |
---|
my_textField.getTextFormat() | Returns a TextFormat object containing formatting information for all text in a text field.
Only properties that are common to all text in the text field are set in the resulting TextFormat
object. Any property that is mixed, meaning that it has different values at different
points in the text, has a value of null . |
my_textField.getTextFormat(beginIndex:Number) | Returns a TextFormat object containing a copy of the text format of the character at the
beginIndex position. |
my_textField.getTextFormat(beginIndex:Number,endIndex:Number) | Returns a TextFormat object containing formatting information for the span of
text from beginIndex to endIndex-1 . Only properties that are common
to all of the text in the specified range are set in the resulting TextFormat object. Any property
that is mixed (that is, has different values at different points in the range) has its value set to null . |
Parameters
| beginIndex:int (default = -1 ) — Optional; an integer that specifies the starting location of a range of text within the text field.
|
|
| endIndex:int (default = -1 ) — Optional; an integer that specifies the position of the first character after the desired
text span. As designed, if you specify beginIndex and endIndex values,
the text from beginIndex to endIndex-1 is read.
|
Returns | flash.text:TextFormat — The TextFormat object that represents the formatting properties for the specified text.
|
public function getUITextFormat():mx.core:UITextFormat
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Returns a UITextFormat object that contains formatting information for this component.
This method is similar to the getTextFormat()
method of the
flash.text.TextField class, but it returns a UITextFormat object instead
of a TextFormat object.
The UITextFormat class extends the TextFormat class to add the text measurement methods
measureText()
and measureHTMLText()
.
Returns public function replaceSelectedText(value:String):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Replaces the current selection with the contents of the value
parameter.
The text is inserted at the position of the current selection, using the current default character
format and default paragraph format. The text is not treated as HTML.
You can use the replaceSelectedText()
method to insert and delete text without disrupting
the character and paragraph formatting of the rest of the text.
Note: This method does not work if a style sheet is applied to the text field.
Parameters
| value:String — The string to replace the currently selected text.
|
public function replaceText(beginIndex:int, endIndex:int, newText:String):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Replaces the range of characters that the beginIndex
and
endIndex
parameters specify with the contents
of the newText
parameter. As designed, the text from
beginIndex
to endIndex-1
is replaced.
Note: This method does not work if a style sheet is applied to the text field.
Parameters
| beginIndex:int — The zero-based index value for the start position of the replacement range.
|
|
| endIndex:int — The zero-based index position of the first character after the desired
text span.
|
|
| newText:String — The text to use to replace the specified range of characters.
|
public function setColor(color:uint):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Sets the font color of the text.
Parameters
| color:uint — The new font color.
|
public function setFocus():void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Sets the focus to this component.
The component may in turn pass focus to a subcomponent.
Note: Only the TextInput and TextArea controls show a highlight
when this method sets the focus.
All controls show a highlight when the user tabs to the control.
public function setSelection(beginIndex:int, endIndex:int):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Sets as selected the text designated by the index values of the
first and last characters, which are specified with the beginIndex
and endIndex
parameters. If the two parameter values are the same,
this method sets the insertion point, as if you set the
caretIndex
property.
Parameters
| beginIndex:int — The zero-based index value of the first character in the selection
(for example, the first character is 0, the second character is 1, and so on).
|
|
| endIndex:int — The zero-based index value of the last character in the selection.
|
public function setTextFormat(format:flash.text:TextFormat, beginIndex:int = -1, endIndex:int = -1):void
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Applies the text formatting that the format
parameter specifies to the specified text in a text field.
The value of format
must be a TextFormat object that specifies the
desired text formatting changes. Only the non-null properties of format
are applied
to the text field. Any property of format
that is set to null
is not
applied. By default, all of the properties of a newly created TextFormat object are set to null
.
Note: This method does not work if a style sheet is applied to the text field.
The setTextFormat()
method changes the text formatting applied to a range of
characters or to the entire body of text in a text field. To apply the properties of format to all text in the text
field, do not specify values for beginIndex
and endIndex
. To apply the
properties of the format to a range of text, specify values for the beginIndex
and
the endIndex
parameters. You can use the length
property to determine
the index values.
The two types of formatting information in a TextFormat object are
character level formatting and paragraph level formatting.
Each character in a text field can have its own character formatting
settings, such as font name, font size, bold, and italic.
For paragraphs, the first character of the paragraph is examined for the paragraph formatting
settings for the entire paragraph. Examples of paragraph formatting settings are left margin,
right margin, and indentation.
Any text inserted manually by the user, or replaced by the
replaceSelectedText()
method, receives the default text field formatting for new text,
and not the formatting specified for the text insertion point. To set the default
formatting for new text, use defaultTextFormat
.
Parameters
| format:flash.text:TextFormat — A TextFormat object that contains character and paragraph formatting information.
|
|
| beginIndex:int (default = -1 ) — Optional; an integer that specifies the zero-based index position specifying the
first character of the desired range of text.
|
|
| endIndex:int (default = -1 ) — Optional; an integer that specifies the first character after the desired text span.
As designed, if you specify beginIndex and endIndex values,
the text from beginIndex to endIndex-1 is updated.
Usage | Description |
---|
my_textField.setTextFormat(textFormat:TextFormat) | Applies the properties of textFormat to all text in the text
field. | my_textField.setTextFormat(textFormat:TextFormat, beginIndex:int) | Applies the properties of textFormat to the text starting with the
beginIndex position. | my_textField.setTextFormat(textFormat:TextFormat, beginIndex:int,
endIndex:int) | Applies the properties of the textFormat parameter to the span of
text from the beginIndex position to the endIndex-1 position. |
Notice that any text inserted manually by the user, or replaced by the
replaceSelectedText() method, receives the default text field formatting for new
text, and not the formatting specified for the text insertion point. To set a text field's
default formatting for new text, use the defaultTextFormat property.
|
public function truncateToFit(truncationIndicator:String = null):Boolean
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Truncate text to make it fit horizontally in the area defined for the control,
and append an ellipsis, three periods (...), to the text.
Parameters
| truncationIndicator:String (default = null ) — The text to be appended after truncation.
If you pass null , a localizable string
such as "..." will be used.
|
Returns | Boolean — true if the text needed truncation.
|
© 2009 Adobe Systems Incorporated. All rights reserved.
Sat Oct 3 2009, 04:15 AM -07:00