| Package | fl.text |
| Class | public class TLFTextField |
| Inheritance | TLFTextField Sprite DisplayObjectContainer InteractiveObject DisplayObject EventDispatcher Object |
| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Create a TLFTextField object the same way you create a text field with the TextField class. Then, use
the textFlow property to assign advanced formatting from the TLF classes. For example:
import fl.text.TLFTextField; import flashx.textLayout.formats.TextLayoutFormat; import flashx.textLayout.elements.TextFlow; var myTLFTextField:TLFTextField = new TLFTextField(); addChild(myTLFTextField); myTLFTextField.x = 10; myTLFTextField.y = 10; myTLFTextField.width = 200 myTLFTextField.height = 100; myTLFTextField.text = "This is my text"; var myFormat:TextLayoutFormat = new TextLayoutFormat(); myFormat.textIndent = 8; myFormat.color = 0x336633; myFormat.fontFamily = "Arial, Helvetica, _sans"; myFormat.fontSize = 24; var myTextFlow:TextFlow = myTLFTextField.textFlow; myTextFlow.hostFormat = myFormat; myTextFlow.flowComposer.updateAllControllers();
More examples
Related API Elements
| Property | Defined By | ||
|---|---|---|---|
![]() | accessibilityImplementation : AccessibilityImplementation
The current accessibility implementation (AccessibilityImplementation)
for this InteractiveObject instance. | InteractiveObject | |
![]() | accessibilityProperties : AccessibilityProperties
The current accessibility options for this display object. | DisplayObject | |
![]() | alpha : Number
Indicates the alpha transparency value of the object specified. | DisplayObject | |
| alwaysShowSelection : Boolean
When set to true and the text field is not in focus, Flash Player highlights the
selection in the text field in light blue. | TLFTextField | ||
| antiAliasType : String
The type of anti-aliasing used for this text field. | TLFTextField | ||
| autoSize : String
Controls automatic sizing and alignment of text fields. | TLFTextField | ||
| background : Boolean
Specifies whether the text field has a background fill. | TLFTextField | ||
| backgroundAlpha : Number
Specifies the alpha value of the text field background. | TLFTextField | ||
| backgroundColor : uint
Specifies the color of the text field background. | TLFTextField | ||
![]() | blendMode : String
A value from the BlendMode class that specifies which blend mode to use. | DisplayObject | |
![]() | blendShader : Shader [write-only]
Sets a shader that is used for blending the foreground and background. | DisplayObject | |
| blockProgression : Object
Specifies a vertical or horizontal progression of line placement. | TLFTextField | ||
| border : Boolean
Specifies whether the text field has a border. | TLFTextField | ||
| borderAlpha : Number
Specifies the alpha value of the border. | TLFTextField | ||
| borderColor : uint
Specifies the color of the text field border. | TLFTextField | ||
| borderWidth : Number
Specifies the width of the border. | TLFTextField | ||
| bottomScrollV : int [read-only]
An integer (1-based index) that indicates the bottommost line that is currently visible in
the specified text field. | TLFTextField | ||
![]() | buttonMode : Boolean
Specifies the button mode of this sprite. | Sprite | |
![]() | cacheAsBitmap : Boolean
If set to true, Flash runtimes cache an internal bitmap representation of the
display object. | DisplayObject | |
![]() | cacheAsBitmapMatrix : Matrix
If non-null, this Matrix object defines how a display object is rendered when
cacheAsBitmap is set to true. | DisplayObject | |
| caretIndex : int [read-only]
The index of the insertion point (caret) position. | TLFTextField | ||
| columnCount : Object
Number of text columns (adopts default value if undefined during cascade). | TLFTextField | ||
| columnGap : Object
Specifies the amount of gutter space, in pixels, to leave between the columns (adopts default value if undefined during cascade). | TLFTextField | ||
| columnWidth : Object
Column width in pixels (adopts default value if undefined during cascade). | TLFTextField | ||
| condenseWhite : Boolean
A Boolean value that specifies whether extra white space (spaces, line breaks, and so on)
in a text field with HTML text, or TLF markup, is removed. | TLFTextField | ||
![]() | constructor : Object
A reference to the class object or constructor function for a given object instance. | Object | |
![]() | contextMenu : NativeMenu
Specifies the context menu associated with this object. | InteractiveObject | |
| defaultTextFormat : flash.text:TextFormat
Specifies the format applied to newly inserted text, such as text entered by a user or text inserted with the
replaceSelectedText() method. | TLFTextField | ||
| direction : String
Specifies the default bidirectional embedding level of the text in the text block. | TLFTextField | ||
| displayAsPassword : Boolean
Specifies whether the text field is a password text field. | TLFTextField | ||
![]() | doubleClickEnabled : Boolean
Specifies whether the object receives doubleClick events. | InteractiveObject | |
![]() | dropTarget : DisplayObject [read-only]
Specifies the display object over which the sprite is being dragged, or on
which the sprite was dropped. | Sprite | |
| embedFonts : Boolean
Specifies whether to render by using embedded font outlines. | TLFTextField | ||
![]() | filters : Array
An indexed array that contains each filter object currently associated with the display object. | DisplayObject | |
| firstBaselineOffset : Object
Specifies the baseline position of the first line in the container. | TLFTextField | ||
![]() | focusRect : Object
Specifies whether this object displays a focus rectangle. | InteractiveObject | |
![]() | graphics : Graphics [read-only]
Specifies the Graphics object that belongs to this sprite where vector
drawing commands can occur. | Sprite | |
| gridFitType : String
The type of grid fitting used for this text field. | TLFTextField | ||
![]() | height : Number
Indicates the height of the display object, in pixels. | DisplayObject | |
![]() | hitArea : Sprite
Designates another sprite to serve as the hit area for a sprite. | Sprite | |
| htmlText : String
Contains the HTML representation of the text field contents. | TLFTextField | ||
| length : int [read-only]
The number of characters in a text field. | TLFTextField | ||
![]() | loaderInfo : LoaderInfo [read-only]
Returns a LoaderInfo object containing information about loading the file
to which this display object belongs. | DisplayObject | |
![]() | mask : DisplayObject
The calling display object is masked by the specified mask object. | DisplayObject | |
| maxChars : int
The maximum number of characters that the text field can contain, as entered by a user. | TLFTextField | ||
| maxScrollH : int [read-only]
The maximum value of scrollH. | TLFTextField | ||
| maxScrollV : int [read-only]
The maximum value of scrollV. | TLFTextField | ||
![]() | mouseChildren : Boolean
Determines whether or not the children of the object are mouse, or user input device, enabled. | DisplayObjectContainer | |
![]() | mouseEnabled : Boolean
Specifies whether this object receives mouse, or other user input, messages. | InteractiveObject | |
| 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. | TLFTextField | ||
![]() | mouseX : Number [read-only]
Indicates the x coordinate of the mouse or user input device position, in pixels. | DisplayObject | |
![]() | mouseY : Number [read-only]
Indicates the y coordinate of the mouse or user input device position, in pixels. | DisplayObject | |
| multiline : Boolean
Indicates whether text field is a multiline text field. | TLFTextField | ||
![]() | name : String
Indicates the instance name of the DisplayObject. | DisplayObject | |
![]() | needsSoftKeyboard : Boolean
Specifies whether a virtual keyboard (an on-screen, software keyboard) should display
when this InteractiveObject instance receives focus. | InteractiveObject | |
![]() | numChildren : int [read-only]
Returns the number of children of this object. | DisplayObjectContainer | |
| numLines : int [read-only]
Defines the number of text lines in a multiline text field. | TLFTextField | ||
![]() | opaqueBackground : Object
Specifies whether the display object is opaque with a certain background color. | DisplayObject | |
| paddingBottom : Object
Botttom inset in pixels (adopts default value if undefined during cascade). | TLFTextField | ||
| paddingLeft : Object
Left inset in pixels (adopts default value if undefined during cascade). | TLFTextField | ||
| paddingRight : Object
Right inset in pixels (adopts default value if undefined during cascade). | TLFTextField | ||
| paddingTop : Object
Top inset in pixels (adopts default value if undefined during cascade). | TLFTextField | ||
![]() | parent : DisplayObjectContainer [read-only]
Indicates the DisplayObjectContainer object that contains this display object. | DisplayObject | |
| pixelMaxScrollV : int [read-only]
The maximum value of pixelScrollV. | TLFTextField | ||
| pixelScrollV : int
The vertical position of text in a text field, in pixels, unlike scrollV, which is based on lines. | TLFTextField | ||
![]() | prototype : Object [static]
A reference to the prototype object of a class or function object. | Object | |
| restrict : String
Indicates the set of characters that a user can enter into the text field. | TLFTextField | ||
![]() | root : DisplayObject [read-only]
For a display object in a loaded SWF file, the root property is the
top-most display object in the portion of the display list's tree structure represented by that SWF file. | DisplayObject | |
![]() | rotation : Number
Indicates the rotation of the DisplayObject instance, in degrees, from its original orientation. | DisplayObject | |
![]() | rotationX : Number
Indicates the x-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container. | DisplayObject | |
![]() | rotationY : Number
Indicates the y-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container. | DisplayObject | |
![]() | rotationZ : Number
Indicates the z-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container. | DisplayObject | |
![]() | scale9Grid : Rectangle
The current scaling grid that is in effect. | DisplayObject | |
![]() | scaleX : Number
Indicates the horizontal scale (percentage) of the object as applied from the registration point. | DisplayObject | |
![]() | scaleY : Number
Indicates the vertical scale (percentage) of an object as applied from the registration point of the object. | DisplayObject | |
![]() | scaleZ : Number
Indicates the depth scale (percentage) of an object as applied from the registration point of the object. | DisplayObject | |
| scrollH : int
The current horizontal scrolling position. | TLFTextField | ||
![]() | scrollRect : Rectangle
The scroll rectangle bounds of the display object. | DisplayObject | |
| scrollV : int
The vertical position of text in a text field. | TLFTextField | ||
| selectable : Boolean
A Boolean value that indicates whether the text field is selectable. | TLFTextField | ||
| selectionBeginIndex : int [read-only]
The zero-based character index value of the first character in the current selection. | TLFTextField | ||
| selectionEndIndex : int [read-only]
The zero-based character index value of the last character in the current selection. | TLFTextField | ||
| sharpness : Number
Sharpness is not applicable to TLF TextFields. | TLFTextField | ||
![]() | softKeyboardInputAreaOfInterest : Rectangle
Defines the area that should remain on-screen when a soft keyboard is displayed. | InteractiveObject | |
![]() | soundTransform : flash.media:SoundTransform
Controls sound within this sprite. | Sprite | |
![]() | stage : Stage [read-only]
The Stage of the display object. | DisplayObject | |
| styleSheet : StyleSheet
Style sheets are not supported by TLF TextFields. | TLFTextField | ||
![]() | tabChildren : Boolean
Determines whether the children of the object are tab enabled. | DisplayObjectContainer | |
![]() | tabEnabled : Boolean
Specifies whether this object is in the tab order. | InteractiveObject | |
![]() | tabIndex : int
Specifies the tab ordering of objects in a SWF file. | InteractiveObject | |
| text : String
A string that is the current text in the text field. | TLFTextField | ||
| textColor : uint
The color of the text in a text field, in hexadecimal format. | TLFTextField | ||
| textFlow : flashx.textLayout.elements:TextFlow
Use this property to assign formatting from the TLF classes in the flashx packages to the TLFTextField instance. | TLFTextField | ||
| textHeight : Number [read-only]
The height of the text in pixels. | TLFTextField | ||
![]() | textSnapshot : flash.text:TextSnapshot [read-only]
Returns a TextSnapshot object for this DisplayObjectContainer instance. | DisplayObjectContainer | |
| textWidth : Number [read-only]
The width of the text in pixels. | TLFTextField | ||
| thickness : Number
The thickness property is not applicable to the TLF TextField. | TLFTextField | ||
| tlfMarkup : String
Sets or gets the TLF markup of the text in the TLF text field. | TLFTextField | ||
![]() | transform : flash.geom:Transform
An object with properties pertaining to a display object's matrix, color transform, and pixel bounds. | DisplayObject | |
| type : String
The type of the text field. | TLFTextField | ||
![]() | useHandCursor : Boolean
A Boolean value that indicates whether the pointing hand (hand cursor) appears when the pointer rolls
over a sprite in which the buttonMode property is set to true. | Sprite | |
| useRichTextClipboard : Boolean
Specifies whether to copy the text formatting along with the text to the clipboard. | TLFTextField | ||
| verticalAlign : String
Vertical alignment or justification (adopts default value if undefined during cascade). | TLFTextField | ||
![]() | visible : Boolean
Whether or not the display object is visible. | DisplayObject | |
![]() | width : Number
Indicates the width of the display object, in pixels. | DisplayObject | |
| wordWrap : Boolean
A Boolean value that indicates whether the text field has word wrap. | TLFTextField | ||
![]() | x : Number
Indicates the x coordinate of the DisplayObject instance relative to the local coordinates of
the parent DisplayObjectContainer. | DisplayObject | |
![]() | y : Number
Indicates the y coordinate of the DisplayObject instance relative to the local coordinates of
the parent DisplayObjectContainer. | DisplayObject | |
![]() | z : Number
Indicates the z coordinate position along the z-axis of the DisplayObject
instance relative to the 3D parent container. | DisplayObject | |
| Method | Defined By | ||
|---|---|---|---|
Constructor for TLFTextField objects. | TLFTextField | ||
![]() |
Adds a child DisplayObject instance to this DisplayObjectContainer instance. | DisplayObjectContainer | |
![]() |
Adds a child DisplayObject instance to this DisplayObjectContainer
instance. | DisplayObjectContainer | |
![]() | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener
receives notification of an event. | EventDispatcher | |
Appends the string specified by the newText parameter to the end of the text
of the text field. | TLFTextField | ||
![]() |
Indicates whether the security restrictions
would cause any display objects to be omitted from the list returned by calling
the DisplayObjectContainer.getObjectsUnderPoint() method
with the specified point point. | DisplayObjectContainer | |
![]() |
Determines whether the specified display object is a child of the DisplayObjectContainer instance or
the instance itself. | DisplayObjectContainer | |
![]() |
Dispatches an event into the event flow. | EventDispatcher | |
![]() |
Returns a rectangle that defines the area of the display object relative to the coordinate system
of the targetCoordinateSpace object. | DisplayObject | |
Returns a rectangle that is the bounding box of the character. | TLFTextField | ||
Returns the zero-based index value of the character at the point specified by the x
and y parameters. | TLFTextField | ||
![]() |
Returns the child display object instance that exists at the specified index. | DisplayObjectContainer | |
![]() |
Returns the child display object that exists with the specified name. | DisplayObjectContainer | |
![]() |
Returns the index position of a child DisplayObject instance. | DisplayObjectContainer | |
Given a character index, returns the index of the first character in the same paragraph. | TLFTextField | ||
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. | TLFTextField | ||
Returns the zero-based index value of the line at the point specified by the x
and y parameters. | TLFTextField | ||
Returns the zero-based index value of the line containing the character specified
by the charIndex parameter. | TLFTextField | ||
Returns the number of characters in a specific text line. | TLFTextField | ||
Returns metrics information about a given text line. | TLFTextField | ||
Returns the character index of the first character in the line that
the lineIndex parameter specifies. | TLFTextField | ||
Returns the text of the line specified by the lineIndex parameter. | TLFTextField | ||
![]() |
Returns an array of objects that lie under the specified point and are children
(or grandchildren, and so on) of this DisplayObjectContainer instance. | DisplayObjectContainer | |
Given a character index, returns the length of the paragraph containing the given character. | TLFTextField | ||
![]() |
Returns a rectangle that defines the boundary of the display object,
based on the coordinate system defined by the targetCoordinateSpace
parameter, excluding any strokes on shapes. | DisplayObject | |
Returns a TextFormat object that contains formatting information for the range of text that the
beginIndex and endIndex parameters specify. | TLFTextField | ||
![]() |
Converts the point object from the Stage (global) coordinates
to the display object's (local) coordinates. | DisplayObject | |
![]() |
Converts a two-dimensional point from the Stage (global) coordinates to a
three-dimensional display object's (local) coordinates. | DisplayObject | |
![]() |
Checks whether the EventDispatcher object has any listeners registered for a specific type
of event. | EventDispatcher | |
![]() |
Indicates whether an object has a specified property defined. | Object | |
![]() |
Evaluates the bounding box of the display object to see if it overlaps or intersects with the
bounding box of the obj display object. | DisplayObject | |
![]() |
Evaluates the display object to see if it overlaps or intersects with the
point specified by the x and y parameters. | DisplayObject | |
Returns true if an embedded font is available with the specified fontName and fontStyle
where Font.fontType is flash.text.FontType.EMBEDDED_CFF. | TLFTextField | ||
![]() |
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | |
![]() |
Converts a three-dimensional point of the three-dimensional display
object's (local) coordinates to a two-dimensional point in the Stage (global) coordinates. | DisplayObject | |
![]() |
Converts the point object from the display object's (local) coordinates to the
Stage (global) coordinates. | DisplayObject | |
![]() |
Indicates whether the specified property exists and is enumerable. | Object | |
![]() |
Removes the specified child DisplayObject instance from the child list of the DisplayObjectContainer instance. | DisplayObjectContainer | |
![]() |
Removes a child DisplayObject from the specified index position in the child list of
the DisplayObjectContainer. | DisplayObjectContainer | |
![]() |
Removes one or more child DisplayObject instances from the DisplayObjectContainer instance. | DisplayObjectContainer | |
![]() |
Removes a listener from the EventDispatcher object. | EventDispatcher | |
Replaces the current selection with the contents of the value parameter. | TLFTextField | ||
Replaces the range of characters that the beginIndex and
endIndex parameters specify with the contents
of the newText parameter. | TLFTextField | ||
![]() |
Raises a virtual keyboard. | InteractiveObject | |
![]() |
Changes the position of an existing child in the display object container. | DisplayObjectContainer | |
![]() |
Sets the availability of a dynamic property for loop operations. | Object | |
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. | TLFTextField | ||
Applies the text formatting that the format parameter specifies to the specified text in a text field. | TLFTextField | ||
![]() |
Lets the user drag the specified sprite. | Sprite | |
![]() |
Lets the user drag the specified sprite on a touch-enabled device. | Sprite | |
![]() |
Ends the startDrag() method. | Sprite | |
![]() |
Ends the startTouchDrag() method, for use with touch-enabled devices. | Sprite | |
![]() |
Swaps the z-order (front-to-back order) of the two specified child objects. | DisplayObjectContainer | |
![]() |
Swaps the z-order (front-to-back order) of the child objects at the two specified index positions in the
child list. | DisplayObjectContainer | |
![]() |
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | |
![]() |
Returns the string representation of the specified object. | Object | |
![]() |
Returns the primitive value of the specified object. | Object | |
![]() |
Checks whether an event listener is registered with this EventDispatcher object or any of
its ancestors for the specified event type. | EventDispatcher | |
| Event | Summary | Defined By | ||
|---|---|---|---|---|
![]() | [broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active. | EventDispatcher | ||
![]() | Dispatched when a display object is added to the display list. | DisplayObject | ||
![]() | Dispatched when a display object is added to the on stage display list, either directly or through the addition of a sub tree in which the display object is contained. | DisplayObject | ||
| Dispatched after a control value is modified, unlike the textInput event, which is dispatched before the value is modified. | TLFTextField | |||
![]() | Dispatched when the user selects 'Clear' (or 'Delete') from the text context menu. | InteractiveObject | ||
![]() | Dispatched when a user presses and releases the main button of the user's pointing device over the same InteractiveObject. | InteractiveObject | ||
![]() | Dispatched when a user gesture triggers the context menu associated with this interactive object in an AIR application. | InteractiveObject | ||
![]() | Dispatched when the user activates the platform-specific accelerator key combination for a copy operation or selects 'Copy' from the text context menu. | InteractiveObject | ||
![]() | Dispatched when the user activates the platform-specific accelerator key combination for a cut operation or selects 'Cut' from the text context menu. | InteractiveObject | ||
![]() | [broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive. | EventDispatcher | ||
![]() | Dispatched when a user presses and releases the main button of a pointing device twice in rapid succession over the same InteractiveObject when that object's doubleClickEnabled flag is set to true. | InteractiveObject | ||
![]() | [broadcast event] Dispatched when the playhead is entering a new frame. | DisplayObject | ||
![]() | [broadcast event] Dispatched when the playhead is exiting the current frame. | DisplayObject | ||
![]() | Dispatched after a display object gains focus. | InteractiveObject | ||
![]() | Dispatched after a display object loses focus. | InteractiveObject | ||
![]() | [broadcast event] Dispatched after the constructors of frame display objects have run but before frame scripts have run. | DisplayObject | ||
![]() | Dispatched when the user moves a point of contact over the InteractiveObject instance on a touch-enabled device (such as moving a finger from left to right over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | ||
![]() | Dispatched when the user creates a point of contact with an InteractiveObject instance, then taps on a touch-enabled device (such as placing several fingers over a display object to open a menu and then taps one finger to select a menu item on a mobile phone or tablet with a touch screen). | InteractiveObject | ||
![]() | Dispatched when the user performs a rotation gesture at a point of contact with an InteractiveObject instance (such as touching two fingers and rotating them over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | ||
![]() | Dispatched when the user performs a swipe gesture at a point of contact with an InteractiveObject instance (such as touching three fingers to a screen and then moving them in parallel over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | ||
![]() | Dispatched when the user presses two points of contact over the same InteractiveObject instance on a touch-enabled device (such as presses and releases two fingers over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | ||
![]() | Dispatched when the user performs a zoom gesture at a point of contact with an InteractiveObject instance (such as touching two fingers to a screen and then quickly spreading the fingers apart over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | ||
![]() | This event is dispatched to any client app that supports inline input with an IME | InteractiveObject | ||
![]() | Dispatched when the user presses a key. | InteractiveObject | ||
![]() | Dispatched when the user attempts to change focus by using keyboard navigation. | InteractiveObject | ||
![]() | Dispatched when the user releases a key. | InteractiveObject | ||
| Dispatched when a user clicks a hyperlink in an HTML-enabled text field, where the URL begins with "event:". | TLFTextField | |||
![]() | Dispatched when a user presses and releases the middle button of the user's pointing device over the same InteractiveObject. | InteractiveObject | ||
![]() | Dispatched when a user presses the middle pointing device button over an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when a user releases the pointing device button over an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when a user presses the pointing device button over an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when the user attempts to change focus by using a pointer device. | InteractiveObject | ||
![]() | Dispatched when a user moves the pointing device while it is over an InteractiveObject. | InteractiveObject | ||
![]() | Dispatched when the user moves a pointing device away from an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when the user moves a pointing device over an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when a user releases the pointing device button over an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when a mouse wheel is spun over an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched by the drag initiator InteractiveObject when the user releases the drag gesture. | InteractiveObject | ||
![]() | Dispatched by the target InteractiveObject when a dragged object is dropped on it and the drop has been accepted with a call to DragManager.acceptDragDrop(). | InteractiveObject | ||
![]() | Dispatched by an InteractiveObject when a drag gesture enters its boundary. | InteractiveObject | ||
![]() | Dispatched by an InteractiveObject when a drag gesture leaves its boundary. | InteractiveObject | ||
![]() | Dispatched by an InteractiveObject continually while a drag gesture remains within its boundary. | InteractiveObject | ||
![]() | Dispatched at the beginning of a drag operation by the InteractiveObject that is specified as the drag initiator in the DragManager.doDrag() call. | InteractiveObject | ||
![]() | Dispatched during a drag operation by the InteractiveObject that is specified as the drag initiator in the DragManager.doDrag() call. | InteractiveObject | ||
![]() | Dispatched when the user activates the platform-specific accelerator key combination for a paste operation or selects 'Paste' from the text context menu. | InteractiveObject | ||
![]() | Dispatched when the user lowers an active stylus past the proximity detection threshold of the screen. | InteractiveObject | ||
![]() | Dispatched when the user lifts an active stylus above the proximity detection threshold of the screen. | InteractiveObject | ||
![]() | Dispatched when the user moves an active stylus over the screen while remaining within the proximity detection threshold. | InteractiveObject | ||
![]() | Dispatched when the user moves an active stylus away from this InteractiveObject while remaining within the proximity detection threshold of the screen. | InteractiveObject | ||
![]() | Dispatched when the user moves an active stylus directly above this InteractiveObject while remaining within the proximity detection threshold of the screen. | InteractiveObject | ||
![]() | Dispatched when the user moves an active stylus away from this InteractiveObject and any of its children while remaining within the proximity detection threshold of the screen. | InteractiveObject | ||
![]() | Dispatched when the user moves an active stylus over this InteractiveObject from outside the object's tree of descendents in the display list (while remaining within the proximity detection threshold of the screen). | InteractiveObject | ||
![]() | Dispatched when a display object is about to be removed from the display list. | DisplayObject | ||
![]() | Dispatched when a display object is about to be removed from the display list, either directly or through the removal of a sub tree in which the display object is contained. | DisplayObject | ||
![]() | [broadcast event] Dispatched when the display list is about to be updated and rendered. | DisplayObject | ||
![]() | Dispatched when a user presses and releases the right button of the user's pointing device over the same InteractiveObject. | InteractiveObject | ||
![]() | Dispatched when a user presses the pointing device button over an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when a user releases the pointing device button over an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when the user moves a pointing device away from an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when the user moves a pointing device over an InteractiveObject instance. | InteractiveObject | ||
| Dispatched by a TextField object after the user scrolls. | TLFTextField | |||
![]() | Dispatched when the user activates the platform-specific accelerator key combination for a select all operation or selects 'Select All' from the text context menu. | InteractiveObject | ||
![]() | Dispatched immediately after the soft keyboard is raised. | InteractiveObject | ||
![]() | Dispatched immediately before the soft keyboard is raised. | InteractiveObject | ||
![]() | Dispatched immediately after the soft keyboard is lowered. | InteractiveObject | ||
![]() | Dispatched when the value of the object's tabChildren flag changes. | InteractiveObject | ||
![]() | Dispatched when the object's tabEnabled flag changes. | InteractiveObject | ||
![]() | Dispatched when the value of the object's tabIndex property changes. | InteractiveObject | ||
| Flash Player dispatches the textInput event when a user enters one or more characters of text. | TLFTextField | |||
![]() | Dispatched when the user first contacts a touch-enabled device (such as touches a finger to a mobile phone or tablet with a touch screen). | InteractiveObject | ||
![]() | Dispatched when the user removes contact with a touch-enabled device (such as lifts a finger off a mobile phone or tablet with a touch screen). | InteractiveObject | ||
![]() | Dispatched when the user moves the point of contact with a touch-enabled device (such as drags a finger across a mobile phone or tablet with a touch screen). | InteractiveObject | ||
![]() | Dispatched when the user moves the point of contact away from InteractiveObject instance on a touch-enabled device (such as drags a finger from one display object to another on a mobile phone or tablet with a touch screen). | InteractiveObject | ||
![]() | Dispatched when the user moves the point of contact over an InteractiveObject instance on a touch-enabled device (such as drags a finger from a point outside a display object to a point over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | ||
![]() | Dispatched when the user moves the point of contact away from an InteractiveObject instance on a touch-enabled device (such as drags a finger from over a display object to a point outside the display object on a mobile phone or tablet with a touch screen). | InteractiveObject | ||
![]() | Dispatched when the user moves the point of contact over an InteractiveObject instance on a touch-enabled device (such as drags a finger from a point outside a display object to a point over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | ||
![]() | Dispatched when the user lifts the point of contact over the same InteractiveObject instance on which the contact was initiated on a touch-enabled device (such as presses and releases a finger from a single point over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | ||
alwaysShowSelection | property |
alwaysShowSelection:Boolean| Language Version: | ActionScript 3.0 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
When set to true and the text field is not in focus, Flash Player highlights the
selection in the text field in light blue. When set to false and the text field is not in
focus, Flash Player does not highlight the selection in the text field.
Example:
package
{
import flash.display.Sprite;
import fl.text.TLFTextField;
import flash.text.TextFieldType;
public class TLFTextField_alwaysShowSelection extends Sprite
{
public function TLFTextField_alwaysShowSelection()
{
var label1:TLFTextField = createTLFTextField(0, 20, 200, 20);
label1.text = "This text is selected.";
label1.setSelection(0, 9);
label1.alwaysShowSelection = true;
var label2:TLFTextField = createTLFTextField(0, 50, 200, 20);
label2.text = "Drag to select some of this text.";
}
private function createTLFTextField(x:Number, y:Number, width:Number, height:Number):TLFTextField
{
var result:TLFTextField = new TLFTextField();
result.x = x;
result.y = y;
result.width = width;
result.height = height;
addChild(result);
return result;
}
}
}
The default value is false.
Implementation
public function get alwaysShowSelection():Boolean public function set alwaysShowSelection(value:Boolean):voidRelated API Elements
antiAliasType | property |
antiAliasType:String| Language Version: | ActionScript 3.0 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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).
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 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 that have a lot of small text. Advanced anti-aliasing is not recommended for fonts that are larger than 48 points. |
The default value is flash.text.AntiAliasType.NORMAL.
Implementation
public function get antiAliasType():String public function set antiAliasType(value:String):voidRelated API Elements
autoSize | property |
autoSize:String| Language Version: | ActionScript 3.0 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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):voidThrows
ArgumentError — The autoSize specified is not a member of flash.text.TextFieldAutoSize.
|
Related API Elements
background | property |
background:Boolean| Language Version: | ActionScript 3.0 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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.
The default value is false.
Implementation
public function get background():Boolean public function set background(value:Boolean):voidRelated API Elements
backgroundAlpha | property |
backgroundAlpha:Number| Language Version: | ActionScript 3.0 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Specifies the alpha value of the text field background. The alpha of the background can be set to any value between
0 (invisible) and 1 (solid).
This property can be retrieved or set, even if there currently is no background, but the
alpha effect is visible only if the text field has the background property set to
true.
The default value is 1.0.
Implementation
public function get backgroundAlpha():Number public function set backgroundAlpha(value:Number):voidRelated API Elements
backgroundColor | property |
backgroundColor:uint| Language Version: | ActionScript 3.0 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Specifies the color of the text field background.
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.
The default value is 0xFFFFFF (white).
Implementation
public function get backgroundColor():uint public function set backgroundColor(value:uint):voidRelated API Elements
blockProgression | property |
blockProgression:Object| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Specifies a vertical or horizontal progression of line placement.
Lines are either placed top-to-bottom (BlockProgression.TB, used for horizontal text) or right-to-left (BlockProgression.RL, used for vertical text).
Legal values are flashx.textLayout.formats.BlockProgression.RL, flashx.textLayout.formats.BlockProgression.TB, flashx.textLayout.formats.FormatValue.INHERIT.
If undefined during the cascade this property will inherit its value from an ancestor. If no ancestor has set this property, it will have a value of TB.
The default value is undefined (indicates not set).
Implementation
public function get blockProgression():Object public function set blockProgression(value:Object):voidRelated API Elements
border | property |
border:Boolean| Language Version: | ActionScript 3.0 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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.
The default value is false.
Implementation
public function get border():Boolean public function set border(value:Boolean):voidRelated API Elements
borderAlpha | property |
borderAlpha:Number| Language Version: | ActionScript 3.0 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Specifies the alpha value of the border. The alpha of the border can be set to any value between
0 (invisible) and 1 (solid).
This property can be retrieved or set, even if there currently is no border, but the
alpha effect is visible only if the text field has the border property set to
true.
The default value is 1.0.
Implementation
public function get borderAlpha():Number public function set borderAlpha(value:Number):voidRelated API Elements
borderColor | property |
borderColor:uint| Language Version: | ActionScript 3.0 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Specifies 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):voidRelated API Elements
borderWidth | property |
borderWidth:Number| Language Version: | ActionScript 3.0 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Specifies the width of the border. The width of the border can be set to any value between
1 and 100.
This property can be retrieved or set, even if there currently is no border, but the
width is visible only if the text field has the border property set to
true.
The width of the border is taken into account when the width or height of the text field is calculated. To get the width or height of the text container without the border, subtract 2 times the borderWidth from the width or height value.
For example, txtHeight = tlf.height - (2 tlf.borderwidth);.
The default value is 1.
Implementation
public function get borderWidth():Number public function set borderWidth(value:Number):voidRelated API Elements
bottomScrollV | property |
bottomScrollV:int [read-only] | Language Version: | ActionScript 3.0 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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 and bottomScroll is the last 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():intRelated API Elements
caretIndex | property |
caretIndex:int [read-only] | Language Version: | ActionScript 3.0 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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).
Example:
package
{
import flash.display.Sprite;
import flash.events.MouseEvent;
import fl.text.TLFTextField;
import flash.text.TextFieldType;
public class TLFTextField_caretIndex extends Sprite
{
public function TLFTextField_caretIndex()
{
var tlf:TLFTextField = createTLFTextField(10, 10, 100, 100);
tlf.wordWrap = true;
tlf.type = TextFieldType.INPUT;
tlf.text = "Click in this text field. Compare the difference between clicking without selecting versus clicking and selecting text.";
tlf.addEventListener(MouseEvent.CLICK, printCursorPosition);
}
private function printCursorPosition(event:MouseEvent):void
{
var tlf:TLFTextField = TLFTextField(event.currentTarget);
trace("caretIndex:", tlf.caretIndex);
trace("selectionBeginIndex:", tlf.selectionBeginIndex);
trace("selectionEndIndex:", tlf.selectionEndIndex);
}
private function createTLFTextField(x:Number, y:Number, width:Number, height:Number):TLFTextField
{
var result:TLFTextField = new TLFTextField();
result.x = x;
result.y = y;
result.width = width;
result.height = height;
addChild(result);
return result;
}
}
}
Implementation
public function get caretIndex():intRelated API Elements
columnCount | property |
columnCount:Object| Language Version: | ActionScript 3.0 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Number of text columns (adopts default value if undefined during cascade).
The column number overrides the other column settings. Value is an integer, or FormatValue.AUTO if unspecified. If columnCount is not specified,columnWidth is used to create as many columns as can fit in the container.
Legal values as a string are flashx.textLayout.formats.FormatValue.AUTO, flashx.textLayout.formats.FormatValue.INHERIT and from ints from 1 to 50.
If undefined during the cascade this property will have a value of AUTO.
The default value is undefined (indicates not set).
Implementation
public function get columnCount():Object public function set columnCount(value:Object):voidRelated API Elements
columnGap | property |
columnGap:Object| Language Version: | ActionScript 3.0 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Specifies the amount of gutter space, in pixels, to leave between the columns (adopts default value if undefined during cascade).
Legal values are numbers from 0 to 1000 and flashx.textLayout.formats.FormatValue.INHERIT.
If undefined during the cascade this property will have a value of 20.
The default value is undefined (indicates not set).
Implementation
public function get columnGap():Object public function set columnGap(value:Object):voidRelated API Elements
columnWidth | property |
columnWidth:Object| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Column width in pixels (adopts default value if undefined during cascade).
If you specify the width of the columns, but not the count, TextLayout will create as many columns of that width as possible, given the container width and columnGap settings. Any remainder space is left after the last column. Value is a Number.
Legal values as a string are flashx.textLayout.formats.FormatValue.AUTO, flashx.textLayout.formats.FormatValue.INHERIT and numbers from 0 to 8000.
If undefined during the cascade this property will have a value of AUTO.
The default value is undefined (indicates not set).
Implementation
public function get columnWidth():Object public function set columnWidth(value:Object):voidRelated API Elements
condenseWhite | property |
condenseWhite:Boolean| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
A Boolean value that specifies whether extra white space (spaces, line breaks, and so on)
in a text field with HTML text, or TLF markup, is removed. The default value is false.
The condenseWhite property only affects TLF markup or 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 tags such as
<br> and <p> to place line breaks in the text field.
Set the condenseWhite property before setting the htmlText property or
the tlfMarkup property.
The following example shows how to use the condenseWhite property to remove
extra space from tlfMarkup content:
import fl.text.TLFTextField; var my_tlf:TLFTextField = new TLFTextField(); my_tlf.autoSize = 'left'; // This line removes white space from tlfMarkup my_tlf.condenseWhite = true; addChild(my_tlf); var my_markup:String = '<TextFlow xmlns="http://ns.adobe.com/textLayout/2008">' + ' <p>' + ' <span>Here is the first span.</span>' + ' \n' + ' <span>And here is the second span.</span>' + ' </p>' + '</TextFlow>'; my_tlf.tlfMarkup = my_markup;
The default value is false.
Implementation
public function get condenseWhite():Boolean public function set condenseWhite(value:Boolean):voidRelated API Elements
defaultTextFormat | property |
defaultTextFormat:flash.text:TextFormat| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Specifies the format applied to newly inserted text, such as text entered by a user or text inserted with the
replaceSelectedText() method.
Implementation
public function get defaultTextFormat():flash.text:TextFormat public function set defaultTextFormat(value:flash.text:TextFormat):voidRelated API Elements
direction | property |
direction:String| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Specifies the default bidirectional embedding level of the text in the text block. Left-to-right reading order, as in Latin-style scripts, or right-to-left reading order, as in Arabic or Hebrew. This property also affects column direction when it is applied at the container level. Columns can be either left-to-right or right-to-left, just like text. Below are some examples:

Legal values are flashx.textLayout.formats.Direction.LTR, flashx.textLayout.formats.Direction.RTL, flashx.textLayout.formats.FormatValue.INHERIT.
If undefined during the cascade this property will inherit its value from an ancestor. If no ancestor has set this property, it will have a value of LTR.
The default value is undefined (indicates not set).
Implementation
public function get direction():String public function set direction(value:String):voidRelated API Elements
displayAsPassword | property |
displayAsPassword:Boolean| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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.
The default value is false.
Implementation
public function get displayAsPassword():Boolean public function set displayAsPassword(value:Boolean):voidembedFonts | property |
embedFonts:Boolean| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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 displayed in a fall back font.
The default value is false.
Implementation
public function get embedFonts():Boolean public function set embedFonts(value:Boolean):voidRelated API Elements
firstBaselineOffset | property |
firstBaselineOffset:Object| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Specifies the baseline position of the first line in the container. Which baseline this property refers to depends on the container-level locale. For Japanese and Chinese, it is TextBaseline.IDEOGRAPHIC_BOTTOM; for all others it is TextBaseline.ROMAN.
The offset from the top inset (or right inset if blockProgression is RL) of the container to the baseline of the first line can be either BaselineOffset.ASCENT, meaning equal to the ascent of the line, BaselineOffset.LINE_HEIGHT, meaning equal to the height of that first line, or any fixed-value number to specify an absolute distance. BaselineOffset.AUTO aligns the ascent of the line with the container top inset.




Legal values as a string are flashx.textLayout.formats.BaselineOffset.AUTO, flashx.textLayout.formats.BaselineOffset.ASCENT, flashx.textLayout.formats.BaselineOffset.LINE_HEIGHT, flashx.textLayout.formats.FormatValue.INHERIT and numbers from 0 to 1000.
If undefined during the cascade this property will inherit its value from an ancestor. If no ancestor has set this property, it will have a value of AUTO.
The default value is undefined (indicates not set).
Implementation
public function get firstBaselineOffset():Object public function set firstBaselineOffset(value:Object):voidRelated API Elements
gridFitType | property |
gridFitType:String| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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. |
The default value is flash.text.GridFitType.PIXEL.
Implementation
public function get gridFitType():String public function set gridFitType(value:String):voidRelated API Elements
htmlText | property |
htmlText:String| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Contains the HTML representation of the text field contents.
TLFTextField instances support the following HTML tags:
| Tag | Description |
|---|---|
| Anchor tag |
The <a> tag creates a hypertext link and supports the following attributes:
|
| 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.
|
| Font tag |
The <font> tag specifies a font or list of fonts to display the text.The font tag
supports the following attributes:
|
| Image tag |
The <img> tag lets you embed external image files (JPEG, GIF, PNG), SWF files, and
movie clips inside text.
The
Note: Unlike the TextField class, the following attributes are not supported:
|
| Italic tag |
The <i> tag displays the tagged text in italics. An italic typeface must be available
for the font used.
|
| List item tag | Note: Unlike the TextField class, the List item tag is not supported. |
| Paragraph tag |
The <p> tag creates a new paragraph.
The <p> tag supports the following attributes:
|
| Span tag |
The <span> tag supports the following attributes:
|
| Text format tag |
The The
|
| Underline tag |
The <u> tag underlines the tagged text.
|
Flash also supports explicit character codes, such as & (ASCII ampersand) and € (Unicode € symbol).
Implementation
public function get htmlText():String public function set htmlText(value:String):voidRelated API Elements
length | property |
maxChars | property |
maxChars:int| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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.
The default value is 0.
Implementation
public function get maxChars():int public function set maxChars(value:int):voidmaxScrollH | property |
maxScrollV | property |
mouseWheelEnabled | property |
mouseWheelEnabled:Boolean| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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. This property is useful if you want to prevent mouse wheel scrolling of text fields, or implement your own text field scrolling.
The default value is true.
Implementation
public function get mouseWheelEnabled():Boolean public function set mouseWheelEnabled(value:Boolean):voidmultiline | property |
multiline:Boolean| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Indicates whether text 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.
The default value is false.
Implementation
public function get multiline():Boolean public function set multiline(value:Boolean):voidRelated API Elements
numLines | property |
numLines:int [read-only] | Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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():intRelated API Elements
paddingBottom | property |
paddingBottom:Object| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Botttom inset in pixels (adopts default value if undefined during cascade). Space between the bottom edge of the container and the text. Value is a Number.
With horizontal text, in scrollable containers with multiple columns, the first and following columns will show the padding as blank space at the bottom of the container, but for the last column, if the text doesn't all fit, you may have to scroll in order to see the padding.
Legal values are numbers from 0 to 1000 and flashx.textLayout.formats.FormatValue.INHERIT.
If undefined during the cascade this property will have a value of 0.
The default value is undefined (indicates not set).
Implementation
public function get paddingBottom():Object public function set paddingBottom(value:Object):voidRelated API Elements
paddingLeft | property |
paddingLeft:Object| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Left inset in pixels (adopts default value if undefined during cascade). Space between the left edge of the container and the text. Value is a Number.
With vertical text, in scrollable containers with multiple columns, the first and following columns will show the padding as blank space at the end of the container, but for the last column, if the text doesn't all fit, you may have to scroll in order to see the padding.
Legal values are numbers from 0 to 1000 and flashx.textLayout.formats.FormatValue.INHERIT.
If undefined during the cascade this property will have a value of 0.
The default value is undefined (indicates not set).
Implementation
public function get paddingLeft():Object public function set paddingLeft(value:Object):voidRelated API Elements
paddingRight | property |
paddingRight:Object| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Right inset in pixels (adopts default value if undefined during cascade). Space between the right edge of the container and the text. Value is a Number.
Legal values are numbers from 0 to 1000 and flashx.textLayout.formats.FormatValue.INHERIT.
If undefined during the cascade this property will have a value of 0.
The default value is undefined (indicates not set).
Implementation
public function get paddingRight():Object public function set paddingRight(value:Object):voidRelated API Elements
paddingTop | property |
paddingTop:Object| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Top inset in pixels (adopts default value if undefined during cascade). Space between the top edge of the container and the text. Value is a Number.
Legal values are numbers from 0 to 1000 and flashx.textLayout.formats.FormatValue.INHERIT.
If undefined during the cascade this property will have a value of 0.
The default value is undefined (indicates not set).
Implementation
public function get paddingTop():Object public function set paddingTop(value:Object):voidRelated API Elements
passwordCharacter | property |
passwordCharacter:String [read-only] Gets or Sets the character used for hiding characters in a password block.
Implementation
tlf_internal function get passwordCharacter():StringpixelMaxScrollV | property |
pixelMaxScrollV:int [read-only] | Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
The maximum value of pixelScrollV.
The units of pixelMaxScrollV are pixels, unlike the maxScrollV property, which is line-based.
Implementation
public function get pixelMaxScrollV():intpixelScrollV | property |
pixelScrollV:int| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
The vertical position of text in a text field, in pixels, unlike scrollV, which is based on lines.
The pixelScrollV property is useful for smoothly scrolling a textField to a particular position.
Implementation
public function get pixelScrollV():int public function set pixelScrollV(value:int):voidRelated API Elements
restrict | property |
restrict:String| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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";
The default value is null.
Implementation
public function get restrict():String public function set restrict(value:String):voidscrollH | property |
scrollH:int| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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):voidRelated API Elements
scrollV | property |
scrollV:int| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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):voidRelated API Elements
selectable | property |
selectable:Boolean| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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 it is editable. Unlike a classic dynamic or input text field,
if a TLF text field is editable, it is always selectable. If this property is set to false and the input
type is set to dynamic, then 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.
The default value is true.
Implementation
public function get selectable():Boolean public function set selectable(value:Boolean):voidRelated API Elements
selectionBeginIndex | property |
selectionBeginIndex:int [read-only] | Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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():intRelated API Elements
selectionEndIndex | property |
selectionEndIndex:int [read-only] | Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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():intRelated API Elements
sharpness | property |
sharpness:Number| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Sharpness is not applicable to TLF TextFields. Any value supplied will be ignored and zero will always be returned.
Implementation
public function get sharpness():Number public function set sharpness(value:Number):voidstyleSheet | property |
styleSheet:StyleSheet| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Style sheets are not supported by TLF TextFields. A null will always be returned and any style sheet set will be ignored.
Implementation
public function get styleSheet():StyleSheet public function set styleSheet(value:StyleSheet):voidtext | property |
text:String| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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):voidRelated API Elements
textColor | property |
textColor:uint| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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.
The default value is 0 (0x000000).
Implementation
public function get textColor():uint public function set textColor(value:uint):voidtextFlow | property |
textFlow:flashx.textLayout.elements:TextFlow| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Use this property to assign formatting from the TLF classes in the flashx packages to the TLFTextField instance. For example:
var myFormat:TextLayoutFormat = new TextLayoutFormat(); myFormat.textIndent = 8; myFormat.color = 0x336633; myFormat.fontFamily = "Arial, Helvetica, _sans"; myFormat.fontSize = 24; var myTextFlow:TextFlow = myTLFTextField.textFlow; myTextFlow.hostFormat = myFormat;
Implementation
public function get textFlow():flashx.textLayout.elements:TextFlow public function set textFlow(value:flashx.textLayout.elements:TextFlow):voidRelated API Elements
textHeight | property |
textHeight:Number [read-only] | Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
The height of the text in pixels. The top and bottom padding are not included in this value.
Implementation
public function get textHeight():NumberRelated API Elements
textWidth | property |
thickness | property |
thickness:Number| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
The thickness property is not applicable to the TLF TextField. Any value supplied will be ignored and zero will always be returned.
Implementation
public function get thickness():Number public function set thickness(value:Number):voidtlfMarkup | property |
tlfMarkup:String| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Sets or gets the TLF markup of the text in the TLF text field.
The markup specification is posted at http://sourceforge.net/projects/tlf.adobe/files/docs/TLF_2.0_specification.pdf/download.
Implementation
public function get tlfMarkup():String public function set tlfMarkup(value:String):voidMore examples
Related API Elements
type | property |
type:String| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
The type of the text field.
Either one of the following TextFieldType constants: TextFieldType.DYNAMIC,
which specifies a selectable TLF text field, which a user cannot edit, or TextFieldType.INPUT,
which specifies an editable TLF text field, which a user can edit.
The default value is dynamic.
Implementation
public function get type():String public function set type(value:String):voidThrows
ArgumentError — The type specified is not a member of flash.text.TextFieldType.
|
Related API Elements
useRichTextClipboard | property |
useRichTextClipboard:Boolean| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Specifies whether to copy the text formatting along with the text to the clipboard. When set to true,
Flash Player copies formatting (such as alignment, bold, and italics) in tlfMarkup format to the clipboard.
The default value is false.
Implementation
public function get useRichTextClipboard():Boolean public function set useRichTextClipboard(value:Boolean):voidRelated API Elements
verticalAlign | property |
verticalAlign:String| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Vertical alignment or justification (adopts default value if undefined during cascade). Determines how TextFlow elements align within the container.
Legal values are flashx.textLayout.formats.VerticalAlign.TOP, flashx.textLayout.formats.VerticalAlign.MIDDLE, flashx.textLayout.formats.VerticalAlign.BOTTOM, flashx.textLayout.formats.VerticalAlign.JUSTIFY, flashx.textLayout.formats.FormatValue.INHERIT.
If undefined during the cascade this property will have a value of TOP.
The default value is undefined (indicates not set).
Implementation
public function get verticalAlign():String public function set verticalAlign(value:String):voidRelated API Elements
wordWrap | property |
wordWrap:Boolean| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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):voidRelated API Elements
TLFTextField | () | Constructor |
public function TLFTextField()| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Constructor for TLFTextField objects. Create a TLFTextField object the same way you create a text field with the TextField class
but use the TLFTextField() constructor instead. For example:
var myTLFTextField:TLFTextField = new TLFTextField();
Related API Elements
appendText | () | method |
public function appendText(newText:String):void| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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.
|
createTextLayoutFormat | () | method |
tlf_internal static function createTextLayoutFormat(format:flash.text:TextFormat):flashx.textLayout.formats:TextLayoutFormatParameters
format:flash.text:TextFormat |
flashx.textLayout.formats:TextLayoutFormat |
getCharBoundaries | () | method |
public function getCharBoundaries(charIndex:int):Rectangle| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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.
|
Related API Elements
getCharIndexAtPoint | () | method |
public function getCharIndexAtPoint(x:Number, y:Number):int| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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.
|
Throws
RangeError — The character index specified is out of range.
|
getImageReference | () | method |
public function getImageReference(id:String):DisplayObject| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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).
|
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.
|
Related API Elements
getLineIndexAtPoint | () | method |
public function getLineIndexAtPoint(x:Number, y:Number):int| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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.
|
Throws
RangeError — The character index specified is out of range.
|
getLineLength | () | method |
public function getLineLength(lineIndex:int):int| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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.
|
Throws
RangeError — The line number specified is out of range.
|
getLineMetrics | () | method |
public function getLineMetrics(lineIndex:int):flash.text:TextLineMetrics| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Returns metrics information about a given text line.
Parameters
lineIndex:int — The line number for which you want metrics information.
|
flash.text:TextLineMetrics — A TextLineMetrics object.
|
Throws
RangeError — The line number specified is out of range.
|
Related API Elements
getLineOffset | () | method |
public function getLineOffset(lineIndex:int):int| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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.
|
Throws
RangeError — The line number specified is out of range.
|
getLineText | () | method |
public function getLineText(lineIndex:int):String| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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.
|
Throws
RangeError — The line number specified is out of range.
|
getParagraphLength | () | method |
public function getParagraphLength(charIndex:int):int| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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.
|
Throws
RangeError — The character index specified is out of range.
|
Related API Elements
getTextFormat | () | method |
public function getTextFormat(beginIndex:int = -1, endIndex:int = -1):flash.text:TextFormat| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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.
|
flash.text:TextFormat — The TextFormat object that represents the formatting properties for the specified text.
|
Throws
RangeError — The beginIndex or endIndex specified is out of range.
|
Related API Elements
isFontCompatible | () | method |
public function isFontCompatible(fontName:String, fontStyle:String):Boolean| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Returns true if an embedded font is available with the specified fontName and fontStyle
where Font.fontType is flash.text.FontType.EMBEDDED_CFF. Starting with Flash Player 10,
two kinds of embedded fonts can appear in a SWF file. FontType.EMBEDDED fonts are only used with
TextField objects and FontType.EMBEDDED_CFF are used with TLFTextField and the flash.text.engine classes. The two types are distinguished by the
fontType property of the Font class, as returned by the enumerateFonts() function.
TLFTextField cannot use a font of type EMBEDDED. If embedFonts is set to true
and the only font available at run time with the specified name and style is of type EMBEDDED,
Flash Player renders the text with a fall back font.
If both EMBEDDED and EMBEDDED_CFF fonts are available with the same name and style, the EMBEDDED_CFF
font is selected and text renders with the EMBEDDED_CFF 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.
|
Throws
ArgumentError — The fontStyle specified is not a member of flash.text.FontStyle.
|
Related API Elements
replaceSelectedText | () | method |
public function replaceSelectedText(value:String):void| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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.
Parameters
value:String — The string to replace the currently selected text.
|
Related API Elements
replaceText | () | method |
public function replaceText(beginIndex:int, endIndex:int, newText:String):void| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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.
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.
|
setSelection | () | method |
public function setSelection(begIdx:int, endIdx:int):void| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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
begIdx: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).
| |
endIdx:int — The zero-based index value of the last character in the selection.
|
Related API Elements
setTextFormat | () | method |
public function setTextFormat(format:flash.text:TextFormat, beginIndex:int = -1, endIndex:int = -1):void| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
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.
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.
Notice that any text inserted manually by the user, or replaced by the
|
Throws
RangeError — The beginIndex or endIndex specified is out of range.
|
Related API Elements
change | Event |
flash.events.Eventproperty Event.type =
flash.events.Event.CHANGE| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Dispatched after a control value is modified, unlike
the textInput event, which is dispatched before the value is modified.
Unlike the W3C DOM Event Model version of the change event, which dispatches the
event only after the control loses focus, the ActionScript 3.0 version of the
change event is dispatched any time the control changes. For example, if a user
types text into a text field, a change event is dispatched after every keystroke.
Example:
package {
import flash.display.Sprite;
import fl.text.TLFTextField;
import flash.text.TextFieldType;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;
import flash.events.Event;
import flash.events.TextEvent;
public class TLFTextField_Event_changeExample extends Sprite {
private var inputTLFTextField:TLFTextField = new TLFTextField();
private var headingTLFTextField:TLFTextField = new TLFTextField();
private var newFormat:TextFormat = new TextFormat();
public function TLFTextField_Event_changeExample() {
newFormat.bold = true;
newFormat.size = 18;
newFormat.color = 0xFF0000;
newFormat.align = TextFormatAlign.CENTER;
headingTLFTextField.defaultTextFormat = newFormat;
headingTLFTextField.x = 10;
headingTLFTextField.y = 10;
headingTLFTextField.background = true;
headingTLFTextField.backgroundColor = 0xF5F5DC;
headingTLFTextField.selectable = false;
this.addChild(headingTLFTextField);
headingTLFTextField.height = 30;
headingTLFTextField.width = 400;
inputTLFTextField.x = 10;
inputTLFTextField.y = 70;
inputTLFTextField.background = true;
inputTLFTextField.border = true;
inputTLFTextField.maxChars = 40;
inputTLFTextField.wordWrap = true;
inputTLFTextField.type = TextFieldType.INPUT;
this.addChild(inputTLFTextField);
inputTLFTextField.height = 20;
inputTLFTextField.width = 230;
inputTLFTextField.addEventListener(Event.CHANGE, changeHandler);
}
private function changeHandler(e:Event):void {
headingTLFTextField.text = inputTLFTextField.text;
}
}
}
The Event.CHANGE constant defines the value of the type property of a change event object.
This event has the following properties:
| Property | Value |
|---|---|
bubbles | true |
cancelable | false; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The object that has had its value modified.
The target is not always the object in the display list
that registered the event listener. Use the currentTarget
property to access the object in the display list that is currently processing the event. |
link | Event |
flash.events.TextEventproperty TextEvent.type =
flash.events.TextEvent.LINK| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Dispatched when a user clicks a hyperlink in an HTML-enabled text field, where the URL begins with "event:". The remainder of the URL after "event:" is placed in the text property of the LINK event.
Note: The default behavior, adding the text to the text field,
occurs only when Flash Player generates the event, which in this case happens when
a user attempts to input text. You cannot put text into a text field by sending it textInput
events.
type property of a link event object.
This event has the following properties:
| Property | Value |
|---|---|
bubbles | true |
cancelable | false; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The text field containing the hyperlink that has been clicked.
The target is not always the object in the display list
that registered the event listener. Use the currentTarget
property to access the object in the display list that is currently processing the event. |
text | The remainder of the URL after "event:" |
scroll | Event |
flash.events.Eventproperty Event.type =
flash.events.Event.SCROLL| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Dispatched by a TextField object after the user scrolls.
TheEvent.SCROLL constant defines the value of the type property of a scroll event object.
This event has the following properties:
| Property | Value |
|---|---|
bubbles | false |
cancelable | false; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The TextField object that has been scrolled.
The target property is not always the object in the display list
that registered the event listener. Use the currentTarget
property to access the object in the display list that is currently processing the event. |
textInput | Event |
flash.events.TextEventproperty TextEvent.type =
flash.events.TextEvent.TEXT_INPUT| Language Version: | ActionScript 3.0 |
| Product Version: | Flash CS5 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Flash Player dispatches the textInput event when a user enters one or more
characters of text. Various
text input methods can generate this event, including standard keyboards,
input method editors (IMEs), voice or speech recognition systems, and even the act
of pasting plain text with no formatting or style information.
type property of a textInput event object.
Note: This event is not dispatched for the Delete or Backspace keys.
This event has the following properties:
| Property | Value |
|---|---|
bubbles | true |
cancelable | true; call the preventDefault() method
to cancel default behavior. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The text field into which characters are being entered.
The target is not always the object in the display list
that registered the event listener. Use the currentTarget
property to access the object in the display list that is currently processing the event. |
text | The character or sequence of characters entered by the user. |
Mon Nov 28 2011, 06:48 AM -08:00
Hide Inherited Public Properties
Show Inherited Public Properties