Package | com.gestureworks.cml.elements |
Class | public class Text |
Inheritance | Text ![]() ![]() |
var txt:Text = new Text(); txt.x = 200; txt.y = 200; txt.font = "OpenSansBold"; txt.fontSize = 30; txt.color = 0xFF0000; addChild(txt);
var tc:TouchContainer = new TouchContainer(); tc.x = 700; tc.y = 300; tc.alpha = .25; tc.scale = 1; //touch interactions tc.gestureList = { "n-drag":true, "n-scale":true, "n-rotate":true }; //loading an image through image element var img:Image = new Image(); img.open("orchid.jpg"); img.x = 0; img.y = 0; img.width = 200; img.rotation = -20; img.id = "img1"; img.scale = 2; tc.addChild(img); //initialise touch container tc.init(); addChild(tc);
See also
Property | Defined By | ||
---|---|---|---|
alwaysShowSelection : Boolean
When set to true and the text field is not in focus, Flash Player highlights the
selection in the text field in gray. | Text | ||
antiAliasType : String
The type of anti-aliasing used for this text field. | Text | ||
![]() | autoShuffle : Boolean
autoshuffles
| TouchContainer | |
autosize : Boolean
Auto-sizes based on text. | Text | ||
autoSize : String
Controls automatic sizing and alignment of text fields. | Text | ||
background : Boolean
Specifies whether the text field has a background fill. | Text | ||
backgroundColor : uint
The color of the text field background. | Text | ||
border : Boolean
Specifies whether the text field has a border. | Text | ||
borderColor : uint
The color of the text field border. | Text | ||
bottomScrollV : int [read-only]
An integer (1-based index) that indicates the bottommost line that is currently visible in
the specified text field. | Text | ||
caretIndex : int [read-only]
The index of the insertion point (caret) position. | Text | ||
charLength : int [read-only]
The number of characters in a text field. | Text | ||
![]() | childList : ChildList
Returns the object's childList. | TouchContainer | |
![]() | className : String
sets the class name of displayobject
| TouchContainer | |
![]() | cloneExclusions : Vector.<String> [read-only]
Returns a list of properties to exclude when cloning this object
| TouchContainer | |
![]() | cmlIndex : int
Returns the index created by the CML parser. | TouchContainer | |
color : *
Sets the color of the text in a text field. | Text | ||
condenseWhite : Boolean
A Boolean value that specifies whether extra white space (spaces, line breaks, and so on)
in a text field with HTML text is removed. | Text | ||
![]() | dimensionsTo : Object
Sets the dimensions of TouchContainer to given object
| TouchContainer | |
displayAsPassword : Boolean
Specifies whether the text field is a password text field. | Text | ||
![]() | dropShadow : Boolean
Sets the drop shadow effect
| TouchContainer | |
embedFonts : Boolean
Specifies whether to render by using embedded font outlines. | Text | ||
font : String
Sets the font of the text. | Text | ||
fontSize : *
Sets the font size of the text. | Text | ||
gridFitType : String
The type of grid fitting used for this text field. | Text | ||
![]() | group : String | TouchContainer | |
height : Number [override]
sets the height of the container
| Text | ||
![]() | heightPercent : Number
sets the height of the container
| TouchContainer | |
horizontalCenter : Number
Sets the horizontal center of the text field. | Text | ||
htmlText : String
Contains the html representation of text field contents. | Text | ||
![]() | id : String
Returns the object's id. | TouchContainer | |
index : int
Specifies the text index. | Text | ||
kerning : Boolean
Sets the gap between certain character pairs. | Text | ||
![]() | layout : *
specifies the type of layout
| TouchContainer | |
![]() | layoutList : Dictionary | TouchContainer | |
leading : Object
Sets the line spacing of text. | Text | ||
letterSpacing : Object
Sets the number of additional pixels to appear between each character. | Text | ||
maxChars : int
The maximum number of characters that the text field can contain, as entered by a user. | Text | ||
maxScrollH : int [read-only]
The maximum value of scrollH. | Text | ||
maxScrollV : int [read-only]
The maximum value of scrollV. | Text | ||
![]() | mouseChildren : Boolean [override]
sets the mousechildren value to true or false. | TouchContainer | |
mouseWheelEnabled : Boolean
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. | Text | ||
multiline : Boolean
Indicates whether field is a multiline text field. | Text | ||
numLines : int [read-only]
Defines the number of text lines in a multiline text field. | Text | ||
![]() | paddingBottom : Number
Sets the number of pixels between the container's bottom border and the bottom of its content area. | TouchContainer | |
![]() | paddingLeft : Number
Sets the number of pixels between the component's left border and the left edge of its content area. | TouchContainer | |
![]() | paddingRight : Number
Sets the number of pixels between the component's right border and the right edge of its content area. | TouchContainer | |
![]() | paddingTop : Number
Sets the number of pixels between the container's top border and the top of its content area. | TouchContainer | |
![]() | position : *
Sets the position
| TouchContainer | |
![]() | relativeX : Boolean
When set true this containers children's x position will be laid out relatively
to each other. | TouchContainer | |
![]() | relativeY : Boolean
When set true this containers children's y position will be laid out relatively
to each other. | TouchContainer | |
restrict : String
Indicates the set of characters that a user can enter into the text field. | Text | ||
scrollH : int
The current horizontal scrolling position. | Text | ||
scrollV : int
The vertical position of text in a text field. | Text | ||
selectable : Boolean
A Boolean value that indicates whether the text field is selectable. | Text | ||
selectedText : String [read-only] | Text | ||
selectionBeginIndex : int [read-only]
The zero-based character index value of the first character in the current selection. | Text | ||
selectionEndIndex : int [read-only]
The zero-based character index value of the last character in the current selection. | Text | ||
sharpness : Number
The sharpness of the glyph edges in this text field. | Text | ||
![]() | sound : String | TouchContainer | |
![]() | state : Dictionary | TouchContainer | |
![]() | stateId : *
Returns the current state id. | TouchContainer | |
str : String
Sets text string. | Text | ||
styleSheet : StyleSheet
Attaches a style sheet to the text field. | Text | ||
text : String
A string that is the current text in the text field. | Text | ||
textAlign : String
Sets the alignment of text in text field. | Text | ||
textBitmap : Boolean
Sets whether the text is left to scale as vector or gets locked as a bitmap. | Text | ||
textColor : *
Sets the color of the text in a text field. | Text | ||
textField : TextField [read-only]
Returns TextField object. | Text | ||
textFormat : TextFormat [read-only]
Returns TextFormat object. | Text | ||
textHeight : Number [read-only]
The height of the text in pixels. | Text | ||
textInteractionMode : String [read-only]
The interaction mode property, Default value is TextInteractionMode.NORMAL. | Text | ||
textSize : *
Sets the font size of the text. | Text | ||
textWidth : Number [read-only]
The width of the text in pixels. | Text | ||
thickness : Number
The thickness of the glyph edges in this text field. | Text | ||
toBitmap : Boolean [override]
Sets whether the text is drawn as a bitmap. | Text | ||
type : String
The type of the text field. | Text | ||
underline : Boolean
Indicates whether text is underlined. | Text | ||
useRichTextClipboard : Boolean [read-only]
Specifies whether to copy and paste the text formatting along with the text. | Text | ||
verticalAlign : Boolean
Sets the vertical alignment of the text field. | Text | ||
verticalCenter : Number
Sets the vertical center of the text field. | Text | ||
width : Number [override]
sets the width of the container
| Text | ||
![]() | widthPercent : Number
sets the width of the container
| TouchContainer | |
wordWrap : Boolean
A Boolean value that indicates whether the text field has word wrap. | Text | ||
y : Number [override]
Sets y position of text. | Text |
Property | Defined By | ||
---|---|---|---|
![]() | cmlGestureList : Object | TouchContainer | |
_textField : TextField
TextField object
| Text | ||
_textFormat : TextFormat
TextFormat object
| Text |
Method | Defined By | ||
---|---|---|---|
Text()
Constructor
| Text | ||
![]() | activateTouch():void | TouchContainer | |
![]() | addAllChildren():void
method searches the child and adds to the list
| TouchContainer | |
![]() | addChild(child:DisplayObject):DisplayObject [override]
Adds child to display list and, if not already added, the child list
| TouchContainer | |
![]() | addChildAt(child:DisplayObject, index:int):DisplayObject [override]
Adds child to display list and, if not already added, the child list
| TouchContainer | |
appendText(newText:String):void
Appends the string specified by the newText parameter to the end of the text
of the text field. | Text | ||
![]() | applyLayout(value:* = null):void
Apply the containers layout
| TouchContainer | |
![]() | childToList(id:String, child:*):void
child appended to the childlist
| TouchContainer | |
clone():* [override]
Clone method
| Text | ||
dispose():void [override]
Destructor
| Text | ||
getCharBoundaries(charIndex:int):Rectangle
Returns a rectangle that is the bounding box of the character. | Text | ||
getCharIndexAtPoint(x:Number, y:Number):int
Returns the zero-based index value of the character at the point specified by the x
and y parameters. | Text | ||
![]() | getElementById(id:String):*
Searches CML childList by id. | TouchContainer | |
![]() | getElementsByClassName(className:String):Array
Searches the CML childList by className. | TouchContainer | |
![]() | getElementsByTagName(tagName:Class):Array
Searches the CML childList by tagName as Class. | TouchContainer | |
getFirstCharInParagraph(charIndex:int):int
Given a character index, returns the index of the first character in the same paragraph. | Text | ||
getImageReference(id:String):DisplayObject
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 tag. | Text | ||
getLineIndexAtPoint(x:Number, y:Number):int
Returns the zero-based index value of the line at the point specified by the x
and y parameters. | Text | ||
getLineIndexOfChar(charIndex:int):int
Returns the zero-based index value of the line containing the character specified
by the charIndex parameter. | Text | ||
getLineLength(lineIndex:int):int
Returns the number of characters in a specific text line. | Text | ||
getLineMetrics(lineIndex:int):TextLineMetrics
Returns metrics information about a given text line. | Text | ||
getLineOffset(lineIndex:int):int
Returns the character index of the first character in the line that
the lineIndex parameter specifies. | Text | ||
getLineText(lineIndex:int):String
Returns the text of the line specified by the lineIndex parameter. | Text | ||
getParagraphLength(charIndex:int):int
Given a character index, returns the length of the paragraph containing the given character. | Text | ||
getRawText():String | Text | ||
getTextFormat(beginIndex:int = -1, endIndex:int = -1):TextFormat
Returns a TextFormat object that contains formatting information for the range of text that the
beginIndex and endIndex parameters specify. | Text | ||
getTextRuns(beginIndex:int = 0, endIndex:int = 2147483647):Array | Text | ||
getXMLText(beginIndex:int = 0, endIndex:int = 2147483647):String | Text | ||
init():void [override]
CML initialization method
| Text | ||
insertXMLText(beginIndex:int, endIndex:int, richText:String, pasting:Boolean = false):void | Text | ||
isFontCompatible(fontName:String, fontStyle:String):Boolean [static]
Returns true if an embedded font is available with the specified fontName and fontStyle
where Font.fontType is flash.text.FontType.EMBEDDED. | Text | ||
![]() | loadState(sId:* = null, recursion:Boolean = false):void
Loads state by index number. | TouchContainer | |
![]() | makeGestureList(value:XMLList):Object
Creates gestureList object from XML
| TouchContainer | |
parseCML(cml:XMLList):XMLList [override]
Parse cml for local layouts. | Text | ||
![]() | postparseCML(cml:XMLList):void
Abstract method allows the setting of a postparse CML routine. | TouchContainer | |
![]() | querySelector(selector:String):*
Searches the CML childList by selector. | TouchContainer | |
![]() | querySelectorAll(selector:*):Array
Search the CML childList by selector. | TouchContainer | |
![]() | removeChild(child:DisplayObject):DisplayObject [override]
Removes child from display list and, if not already removed, the child list
| TouchContainer | |
![]() | removeChildAt(index:int):DisplayObject [override]
Removes child from display list and, if not already removed, the child list
| TouchContainer | |
![]() | removeChildren(beginIndex:int = 0, endIndex:int = 2147483647):void [override]
Removes children from display list and, if not already removed, the child list
| TouchContainer | |
replaceSelectedText(value:String):void
Replaces the current selection with the contents of the value parameter. | Text | ||
replaceText(beginIndex:int, endIndex:int, newText:String):void
Replaces the range of characters that the beginIndex and
endIndex parameters specify with the contents
of the newText parameter. | Text | ||
![]() | saveState(sId:* = null, recursion:Boolean = false):void
Save state by index number. | TouchContainer | |
![]() | searchChildren(value:*, returnType:Class = null):*
This method does a depth first search of childLists. | TouchContainer | |
![]() | setDimensionsToChild():void
method sets the dimensions of each child
| TouchContainer | |
setSelection(beginIndex:int, endIndex:int):void
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. | Text | ||
![]() | tweenState(sId:* = null, tweenTime:Number = 1):void
Tween state by stateIndex from current to given state index. | TouchContainer | |
![]() | updatePadding():void
Updates child padding within this container
| TouchContainer | |
![]() | updatePercentDim():void
Updates child percent dimensions within this container
| TouchContainer | |
![]() | updateProperties(state:* = 0):void
Updates properties from state. | TouchContainer | |
![]() | updateRelativePos():void
Updates child relative positions within this container
| TouchContainer | |
updateTextFormat():void
Redraws text with new settings. | Text |
_textField | property |
protected var _textField:TextField
TextField object
_textFormat | property |
protected var _textFormat:TextFormat
TextFormat object
alwaysShowSelection | property |
alwaysShowSelection:Boolean
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.
public function get alwaysShowSelection():Boolean
public function set alwaysShowSelection(value:Boolean):void
antiAliasType | property |
antiAliasType:String
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 valueDescriptionflash.text.AntiAliasType.NORMALApplies 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.
public function get antiAliasType():String
public function set antiAliasType(value:String):void
autosize | property |
autosize:Boolean
Auto-sizes based on text.
public function get autosize():Boolean
public function set autosize(value:Boolean):void
autoSize | property |
autoSize:String
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.
public function get autoSize():String
public function set autoSize(value:String):void
ArgumentError — The autoSize specified is not a member of flash.text.TextFieldAutoSize.
|
background | property |
background:Boolean
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.
public function get background():Boolean
public function set background(value:Boolean):void
backgroundColor | property |
backgroundColor:uint
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.
public function get backgroundColor():uint
public function set backgroundColor(value:uint):void
border | property |
border:Boolean
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.
public function get border():Boolean
public function set border(value:Boolean):void
borderColor | property |
borderColor:uint
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.
public function get borderColor():uint
public function set borderColor(value:uint):void
bottomScrollV | property |
bottomScrollV:int
[read-only] 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.
public function get bottomScrollV():int
caretIndex | property |
caretIndex:int
[read-only] 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).
public function get caretIndex():int
charLength | property |
charLength:int
[read-only] The number of characters in a text field. A character such as tab (\t) counts as one character.
public function get charLength():int
color | property |
color:*
Sets the color of the text in a text field.
The default value is = 0x000000;
.
public function get color():*
public function set color(value:any):void
condenseWhite | property |
condenseWhite:Boolean
public function get condenseWhite():Boolean
public function set condenseWhite(value:Boolean):void
displayAsPassword | property |
displayAsPassword:Boolean
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.
public function get displayAsPassword():Boolean
public function set displayAsPassword(value:Boolean):void
embedFonts | property |
embedFonts:Boolean
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.
public function get embedFonts():Boolean
public function set embedFonts(value:Boolean):void
font | property |
font:String
Sets the font of the text.
The default value is "OpenSansRegular";
.
public function get font():String
public function set font(value:String):void
fontSize | property |
fontSize:*
Sets the font size of the text.
The default value is 15;
.
public function get fontSize():*
public function set fontSize(value:any):void
gridFitType | property |
gridFitType:String
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. You can use the following string values: subpixel, pixel, none.
public function get gridFitType():String
public function set gridFitType(value:String):void
height | property |
height:Number
[override] sets the height of the container
public function get height():Number
public function set height(value:Number):void
horizontalCenter | property |
horizontalCenter:Number
Sets the horizontal center of the text field.
public function get horizontalCenter():Number
public function set horizontalCenter(value:Number):void
htmlText | property |
htmlText:String
Contains the html representation of text field contents.
public function get htmlText():String
public function set htmlText(value:String):void
index | property |
index:int
Specifies the text index.
public function get index():int
public function set index(value:int):void
kerning | property |
kerning:Boolean
Sets the gap between certain character pairs.
public function get kerning():Boolean
public function set kerning(value:Boolean):void
leading | property |
leading:Object
Sets the line spacing of text.
public function get leading():Object
public function set leading(value:Object):void
letterSpacing | property |
letterSpacing:Object
Sets the number of additional pixels to appear between each character.
The default value is 0;
.
public function get letterSpacing():Object
public function set letterSpacing(value:Object):void
maxChars | property |
maxChars:int
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.
public function get maxChars():int
public function set maxChars(value:int):void
maxScrollH | property |
maxScrollH:int
[read-only] The maximum value of scrollH.
public function get maxScrollH():int
maxScrollV | property |
maxScrollV:int
[read-only] The maximum value of scrollV.
public function get maxScrollV():int
mouseWheelEnabled | property |
mouseWheelEnabled:Boolean
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 9 |
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.
public function get mouseWheelEnabled():Boolean
public function set mouseWheelEnabled(value:Boolean):void
multiline | property |
multiline:Boolean
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.
public function get multiline():Boolean
public function set multiline(value:Boolean):void
numLines | property |
numLines:int
[read-only] 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.
public function get numLines():int
restrict | property |
restrict:String
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. This property does not synchronize with the Embed font options in the Property inspector.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";
public function get restrict():String
public function set restrict(value:String):void
scrollH | property |
scrollH:int
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.
public function get scrollH():int
public function set scrollH(value:int):void
scrollV | property |
scrollV:int
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.
public function get scrollV():int
public function set scrollV(value:int):void
selectable | property |
selectable:Boolean
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.
public function get selectable():Boolean
public function set selectable(value:Boolean):void
selectedText | property |
selectedText:String
[read-only] public function get selectedText():String
selectionBeginIndex | property |
selectionBeginIndex:int
[read-only] 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.
public function get selectionBeginIndex():int
selectionEndIndex | property |
selectionEndIndex:int
[read-only] 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.
public function get selectionEndIndex():int
sharpness | property |
sharpness:Number
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).
public function get sharpness():Number
public function set sharpness(value:Number):void
str | property |
str:String
Sets text string. Same as text.
public function get str():String
public function set str(value:String):void
styleSheet | property |
styleSheet:StyleSheet
Attaches a style sheet to the text field. For information on creating style sheets, see the StyleSheet class and the ActionScript 3.0 Developer's Guide. 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.
public function get styleSheet():StyleSheet
public function set styleSheet(value:StyleSheet):void
text | property |
text:String
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.
public function get text():String
public function set text(value:String):void
textAlign | property |
textAlign:String
Sets the alignment of text in text field.
public function get textAlign():String
public function set textAlign(value:String):void
textBitmap | property |
textBitmap:Boolean
Sets whether the text is left to scale as vector or gets locked as a bitmap. Same as toBitmap.
public function get textBitmap():Boolean
public function set textBitmap(value:Boolean):void
textColor | property |
textColor:*
Sets the color of the text in a text field.
The default value is = 0x000000;
.
public function get textColor():*
public function set textColor(value:any):void
textField | property |
textField:TextField
[read-only] Returns TextField object.
public function get textField():TextField
textFormat | property |
textFormat:TextFormat
[read-only] Returns TextFormat object.
public function get textFormat():TextFormat
textHeight | property |
textHeight:Number
[read-only] The height of the text in pixels.
public function get textHeight():Number
textInteractionMode | property |
textInteractionMode:String
[read-only] The interaction mode property, Default value is TextInteractionMode.NORMAL. On mobile platforms, the normal mode implies that the text can be scrolled but not selected. One can switch to the selectable mode through the in-built context menu on the text field. On Desktop, the normal mode implies that the text is in scrollable as well as selection mode.
public function get textInteractionMode():String
textSize | property |
textSize:*
Sets the font size of the text. Same as fontSize.
The default value is 15;
.
public function get textSize():*
public function set textSize(value:any):void
textWidth | property |
textWidth:Number
[read-only] Language Version : | ActionScript 3.0 |
Runtime Versions : | Flash Player 9, Flash Lite 4 |
The width of the text in pixels.
public function get textWidth():Number
thickness | property |
thickness:Number
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).
public function get thickness():Number
public function set thickness(value:Number):void
toBitmap | property |
toBitmap:Boolean
[override] Sets whether the text is drawn as a bitmap. Unlike cacheAsBitmap, this is a permanant bitmap cache. This a critical performance optimization for text fields that are frequently scaled and rotated. Optimally, set true when scaling and rotating and then set false when the transfomations have stopped.
public function get toBitmap():Boolean
public function set toBitmap(value:Boolean):void
type | property |
type:String
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.
public function get type():String
public function set type(value:String):void
ArgumentError — The type specified is not a member of flash.text.TextFieldType.
|
underline | property |
underline:Boolean
Indicates whether text is underlined.
public function get underline():Boolean
public function set underline(value:Boolean):void
useRichTextClipboard | property |
useRichTextClipboard:Boolean
[read-only] Specifies whether to copy and paste the text formatting along with the text. When set to true, Flash Player copies and pastes formatting(such as alignment, bold, and italics) when you copy and paste between text fields. Both the origin and destination text fields for the copy and paste procedure must have useRichTextClipboard set to true. The default value is false.
public function get useRichTextClipboard():Boolean
verticalAlign | property |
verticalAlign:Boolean
Sets the vertical alignment of the text field.
The default value is false;
.
public function get verticalAlign():Boolean
public function set verticalAlign(value:Boolean):void
verticalCenter | property |
verticalCenter:Number
Sets the vertical center of the text field.
public function get verticalCenter():Number
public function set verticalCenter(value:Number):void
width | property |
width:Number
[override] sets the width of the container
public function get width():Number
public function set width(value:Number):void
wordWrap | property |
wordWrap:Boolean
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.
public function get wordWrap():Boolean
public function set wordWrap(value:Boolean):void
y | property |
y:Number
[override] Sets y position of text.
public function get y():Number
public function set y(value:Number):void
Text | () | Constructor |
public function Text()
Constructor
appendText | () | method |
public function appendText(newText:String):void
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.
|
clone | () | method |
override public function clone():*
Clone method
Returns* |
dispose | () | method |
override public function dispose():void
Destructor
getCharBoundaries | () | method |
public function getCharBoundaries(charIndex:int):Rectangle
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).
|
Rectangle — A rectangle with x and y minimum and maximum values
defining the bounding box of the character.
|
getCharIndexAtPoint | () | method |
public function getCharIndexAtPoint(x:Number, y:Number):int
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.
|
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.
|
getFirstCharInParagraph | () | method |
public function getFirstCharInParagraph(charIndex:int):int
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).
|
int — The zero-based index value of the first character in the same paragraph.
|
RangeError — The character index specified is out of range.
|
getImageReference | () | method |
public function getImageReference(id:String):DisplayObject
Parameters
id:String |
DisplayObject — |
getLineIndexAtPoint | () | method |
public function getLineIndexAtPoint(x:Number, y:Number):int
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.
|
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.
|
getLineIndexOfChar | () | method |
public function getLineIndexOfChar(charIndex:int):int
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).
|
int — The zero-based index value of the line.
|
RangeError — The character index specified is out of range.
|
getLineLength | () | method |
public function getLineLength(lineIndex:int):int
Returns the number of characters in a specific text line.
Parameters
lineIndex:int — The line number for which you want the length.
|
int — The number of characters in the line.
|
RangeError — The line number specified is out of range.
|
getLineMetrics | () | method |
public function getLineMetrics(lineIndex:int):TextLineMetrics
Returns metrics information about a given text line.
Parameters
lineIndex:int — The line number for which you want metrics information.
|
TextLineMetrics — A TextLineMetrics object.
|
RangeError — The line number specified is out of range.
|
getLineOffset | () | method |
public function getLineOffset(lineIndex:int):int
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).
|
int — The zero-based index value of the first character in the line.
|
RangeError — The line number specified is out of range.
|
getLineText | () | method |
public function getLineText(lineIndex:int):String
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).
|
String — The text string contained in the specified line.
|
RangeError — The line number specified is out of range.
|
getParagraphLength | () | method |
public function getParagraphLength(charIndex:int):int
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).
|
int — Returns the number of characters in the paragraph.
|
RangeError — The character index specified is out of range.
|
getRawText | () | method |
public function getRawText():String
ReturnsString |
getTextFormat | () | method |
public function getTextFormat(beginIndex:int = -1, endIndex:int = -1):TextFormat
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:UsageDescriptionmy_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.
|
TextFormat — The TextFormat object that represents the formatting properties for the specified text.
|
RangeError — The beginIndex or endIndex specified is out of range.
|
getTextRuns | () | method |
public function getTextRuns(beginIndex:int = 0, endIndex:int = 2147483647):Array
Parameters
beginIndex:int (default = 0 )
| |
endIndex:int (default = 2147483647 )
|
Array |
getXMLText | () | method |
public function getXMLText(beginIndex:int = 0, endIndex:int = 2147483647):String
Parameters
beginIndex:int (default = 0 )
| |
endIndex:int (default = 2147483647 )
|
String |
init | () | method |
override public function init():void
CML initialization method
insertXMLText | () | method |
public function insertXMLText(beginIndex:int, endIndex:int, richText:String, pasting:Boolean = false):void
Parameters
beginIndex:int | |
endIndex:int | |
richText:String | |
pasting:Boolean (default = false )
|
isFontCompatible | () | method |
public static function isFontCompatible(fontName:String, fontStyle:String):Boolean
Language Version : | ActionScript 3.0 |
Runtime Versions : | Flash Player 10, AIR 1.5, Flash Lite 4 |
Returns true if an embedded font is available with the specified fontName and fontStyle where Font.fontType is flash.text.FontType.EMBEDDED. Starting with Flash Player 10, two kinds of embedded fonts can appear in a SWF file. Normal embedded fonts are only used with TextField objects. CFF embedded fonts are only used with the flash.text.engine classes. The two types are distinguished by the fontType property of the Font class, as returned by the enumerateFonts() function. TextField cannot use a font of type EMBEDDED_CFF. If embedFonts is set to true and the only font available at run time with the specified name and style is of type EMBEDDED_CFF, Flash Player fails to render the text, as if no embedded font were available with the specified name and style.If both EMBEDDED and EMBEDDED_CFF fonts are available with the same name and style, the EMBEDDED font is selected and text renders with the EMBEDDED font.
Parameters
fontName:String — The name of the embedded font to check.
| |
fontStyle:String — Specifies the font style to check. Use flash.text.FontStyle
|
Boolean — true if a compatible embedded font is available, otherwise false.
|
ArgumentError — The fontStyle specified is not a member of flash.text.FontStyle.
|
parseCML | () | method |
override public function parseCML(cml:XMLList):XMLList
Parse cml for local layouts.
Parameters
cml:XMLList |
XMLList —
|
replaceSelectedText | () | method |
public function replaceSelectedText(value:String):void
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.
|
Error — This method cannot be used on a text field with a style sheet.
|
replaceText | () | method |
public function replaceText(beginIndex:int, endIndex:int, newText:String):void
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.
|
Error — This method cannot be used on a text field with a style sheet.
|
setSelection | () | method |
public function setSelection(beginIndex:int, endIndex:int):void
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.
|
updateTextFormat | () | method |
public function updateTextFormat():void
Redraws text with new settings. Generally called automatically when a new property value is set.