ActionScript® 3.0 Reference for the Adobe® Flash® Platform
Home  |  Show Packages and Classes List |  Packages  |  Classes  |  What's New  |  Index  |  Appendixes
fl.text 

TLFTextField  - AS3 Flash

Packagefl.text
Classpublic class TLFTextField
InheritanceTLFTextField Inheritance Sprite Inheritance DisplayObjectContainer Inheritance InteractiveObject Inheritance DisplayObject Inheritance EventDispatcher Inheritance Object

Language Version: ActionScript 3.0
Product Version: Flash CS5
Runtime Versions: Flash Player 10, AIR 1.5

Use the TLFTextField class to create text fields that use the advanced text display features of the Text Layout Framework (TLF). TLFTextField objects are similar to TextField objects, but TLFTextField objects can utilize the properties and methods of the TLF classes included in the flashx packages. TLF provides a large set of formatting options and features.

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

Learn more

Related API Elements



Public Properties
 PropertyDefined By
 InheritedaccessibilityImplementation : AccessibilityImplementation
The current accessibility implementation (AccessibilityImplementation) for this InteractiveObject instance.
InteractiveObject
 InheritedaccessibilityProperties : AccessibilityProperties
The current accessibility options for this display object.
DisplayObject
 Inheritedalpha : 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
 InheritedblendMode : String
A value from the BlendMode class that specifies which blend mode to use.
DisplayObject
 InheritedblendShader : 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
 InheritedbuttonMode : Boolean
Specifies the button mode of this sprite.
Sprite
 InheritedcacheAsBitmap : Boolean
If set to true, Flash runtimes cache an internal bitmap representation of the display object.
DisplayObject
 Inherited    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
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 InheritedcontextMenu : 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
 InheriteddoubleClickEnabled : Boolean
Specifies whether the object receives doubleClick events.
InteractiveObject
 InheriteddropTarget : 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
 Inheritedfilters : 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
 InheritedfocusRect : Object
Specifies whether this object displays a focus rectangle.
InteractiveObject
 Inheritedgraphics : 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
 Inheritedheight : Number
Indicates the height of the display object, in pixels.
DisplayObject
 InheritedhitArea : 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
 InheritedloaderInfo : LoaderInfo
[read-only] Returns a LoaderInfo object containing information about loading the file to which this display object belongs.
DisplayObject
 Inheritedmask : 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
 InheritedmetaData : Object
Obtains the meta data object of the DisplayObject instance if meta data was stored alongside the the instance of this DisplayObject in the SWF file through a PlaceObject4 tag.
DisplayObject
 InheritedmouseChildren : Boolean
Determines whether or not the children of the object are mouse, or user input device, enabled.
DisplayObjectContainer
 InheritedmouseEnabled : 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
 InheritedmouseX : Number
[read-only] Indicates the x coordinate of the mouse or user input device position, in pixels.
DisplayObject
 InheritedmouseY : 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
 Inheritedname : String
Indicates the instance name of the DisplayObject.
DisplayObject
 InheritedneedsSoftKeyboard : Boolean
Specifies whether a virtual keyboard (an on-screen, software keyboard) should display when this InteractiveObject instance receives focus.
InteractiveObject
 InheritednumChildren : 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
 InheritedopaqueBackground : 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
 Inheritedparent : 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
  restrict : String
Indicates the set of characters that a user can enter into the text field.
TLFTextField
 Inheritedroot : 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
 Inheritedrotation : Number
Indicates the rotation of the DisplayObject instance, in degrees, from its original orientation.
DisplayObject
 InheritedrotationX : Number
Indicates the x-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container.
DisplayObject
 InheritedrotationY : Number
Indicates the y-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container.
DisplayObject
 InheritedrotationZ : Number
Indicates the z-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container.
DisplayObject
 Inheritedscale9Grid : Rectangle
The current scaling grid that is in effect.
DisplayObject
 InheritedscaleX : Number
Indicates the horizontal scale (percentage) of the object as applied from the registration point.
DisplayObject
 InheritedscaleY : Number
Indicates the vertical scale (percentage) of an object as applied from the registration point of the object.
DisplayObject
 InheritedscaleZ : 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
 InheritedscrollRect : 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
 InheritedsoftKeyboardInputAreaOfInterest : Rectangle
Defines the area that should remain on-screen when a soft keyboard is displayed (not available on iOS).
InteractiveObject
 InheritedsoundTransform : flash.media:SoundTransform
Controls sound within this sprite.
Sprite
 Inheritedstage : Stage
[read-only] The Stage of the display object.
DisplayObject
  styleSheet : StyleSheet
Style sheets for the TLF TextField.
TLFTextField
 InheritedtabChildren : Boolean
Determines whether the children of the object are tab enabled.
DisplayObjectContainer
 InheritedtabEnabled : Boolean
Specifies whether this object is in the tab order.
InteractiveObject
 InheritedtabIndex : 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
 InheritedtextSnapshot : 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
 Inheritedtransform : 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
 InheriteduseHandCursor : 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
 Inheritedvisible : Boolean
Whether or not the display object is visible.
DisplayObject
 Inheritedwidth : 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
 Inheritedx : Number
Indicates the x coordinate of the DisplayObject instance relative to the local coordinates of the parent DisplayObjectContainer.
DisplayObject
 Inheritedy : Number
Indicates the y coordinate of the DisplayObject instance relative to the local coordinates of the parent DisplayObjectContainer.
DisplayObject
 Inheritedz : Number
Indicates the z coordinate position along the z-axis of the DisplayObject instance relative to the 3D parent container.
DisplayObject
Public Methods
 MethodDefined By
  
Constructor for TLFTextField objects.
TLFTextField
 Inherited
Adds a child DisplayObject instance to this DisplayObjectContainer instance.
DisplayObjectContainer
 Inherited
Adds a child DisplayObject instance to this DisplayObjectContainer instance.
DisplayObjectContainer
 Inherited
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
 Inherited
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
 Inherited
Determines whether the specified display object is a child of the DisplayObjectContainer instance or the instance itself.
DisplayObjectContainer
 Inherited
Dispatches an event into the event flow.
EventDispatcher
 Inherited
getBounds(targetCoordinateSpace:DisplayObject):Rectangle
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
 Inherited
Returns the child display object instance that exists at the specified index.
DisplayObjectContainer
 Inherited
Returns the child display object that exists with the specified name.
DisplayObjectContainer
 Inherited
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
  
getLineLength(lineIndex:int):int
Returns the number of characters in a specific text line.
TLFTextField
  
Returns metrics information about a given text line.
TLFTextField
  
getLineOffset(lineIndex:int):int
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
 Inherited
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
 Inherited
getRect(targetCoordinateSpace:DisplayObject):Rectangle
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
  
getTextFormat(beginIndex:int = -1, endIndex:int = -1):flash.text:TextFormat
Returns a TextFormat object that contains formatting information for the range of text that the beginIndex and endIndex parameters specify.
TLFTextField
 Inherited
Converts the point object from the Stage (global) coordinates to the display object's (local) coordinates.
DisplayObject
 Inherited
Converts a two-dimensional point from the Stage (global) coordinates to a three-dimensional display object's (local) coordinates.
DisplayObject
 Inherited
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
EventDispatcher
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
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
 Inherited
hitTestPoint(x:Number, y:Number, shapeFlag:Boolean = false):Boolean
Evaluates the display object to see if it overlaps or intersects with the point specified by the x and y parameters.
DisplayObject
  
isFontCompatible(fontName:String, fontStyle:String):Boolean
Returns true if an embedded font is available with the specified fontName and fontStyle where Font.fontType is flash.text.FontType.EMBEDDED_CFF.
TLFTextField
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
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
 Inherited
Converts the point object from the display object's (local) coordinates to the Stage (global) coordinates.
DisplayObject
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
Removes the specified child DisplayObject instance from the child list of the DisplayObjectContainer instance.
DisplayObjectContainer
 Inherited
Removes a child DisplayObject from the specified index position in the child list of the DisplayObjectContainer.
DisplayObjectContainer
 Inherited
removeChildren(beginIndex:int = 0, endIndex:int = 0x7fffffff):void
Removes all child DisplayObject instances from the child list of the DisplayObjectContainer instance.
DisplayObjectContainer
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
EventDispatcher
  
Replaces the current selection with the contents of the value parameter.
TLFTextField
  
replaceText(beginIndex:int, endIndex:int, newText:String):void
Replaces the range of characters that the beginIndex and endIndex parameters specify with the contents of the newText parameter.
TLFTextField
 Inherited
Raises a virtual keyboard.
InteractiveObject
 Inherited
Changes the position of an existing child in the display object container.
DisplayObjectContainer
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
  
setSelection(begIdx:int, endIdx:int):void
Sets as selected the text designated by the index values of the first and last characters, which are specified with the beginIndex and endIndex parameters.
TLFTextField
  
setTextFormat(format:flash.text:TextFormat, beginIndex:int = -1, endIndex:int = -1):void
Applies the text formatting that the format parameter specifies to the specified text in a text field.
TLFTextField
 Inherited
startDrag(lockCenter:Boolean = false, bounds:Rectangle = null):void
Lets the user drag the specified sprite.
Sprite
 Inherited
startTouchDrag(touchPointID:int, lockCenter:Boolean = false, bounds:Rectangle = null):void
Lets the user drag the specified sprite on a touch-enabled device.
Sprite
 Inherited
Recursively stops the timeline execution of all MovieClips rooted at this object.
DisplayObjectContainer
 Inherited
Ends the startDrag() method.
Sprite
 Inherited
stopTouchDrag(touchPointID:int):void
Ends the startTouchDrag() method, for use with touch-enabled devices.
Sprite
 Inherited
Swaps the z-order (front-to-back order) of the two specified child objects.
DisplayObjectContainer
 Inherited
swapChildrenAt(index1:int, index2:int):void
Swaps the z-order (front-to-back order) of the child objects at the two specified index positions in the child list.
DisplayObjectContainer
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
 Inherited
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
EventDispatcher
Events
 Event Summary Defined By
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active.EventDispatcher
 InheritedDispatched when a display object is added to the display list.DisplayObject
 InheritedDispatched 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
 InheritedDispatched when the user selects 'Clear' (or 'Delete') from the text context menu.InteractiveObject
 InheritedDispatched when a user presses and releases the main button of the user's pointing device over the same InteractiveObject.InteractiveObject
 Inherited
    contextMenu
Dispatched when a user gesture triggers the context menu associated with this interactive object in an AIR application.InteractiveObject
 InheritedDispatched when the user activates the platform-specific accelerator key combination for a copy operation or selects 'Copy' from the text context menu.InteractiveObject
 InheritedDispatched when the user activates the platform-specific accelerator key combination for a cut operation or selects 'Cut' from the text context menu.InteractiveObject
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive.EventDispatcher
 InheritedDispatched 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
 Inherited[broadcast event] Dispatched when the playhead is entering a new frame.DisplayObject
 Inherited[broadcast event] Dispatched when the playhead is exiting the current frame.DisplayObject
 InheritedDispatched after a display object gains focus.InteractiveObject
 InheritedDispatched after a display object loses focus.InteractiveObject
 Inherited[broadcast event] Dispatched after the constructors of frame display objects have run but before frame scripts have run.DisplayObject
 InheritedDispatched 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
 InheritedDispatched 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
 InheritedDispatched 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
 InheritedDispatched 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
 InheritedDispatched 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
 InheritedDispatched 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
 InheritedThis event is dispatched to any client app that supports inline input with an IMEInteractiveObject
 InheritedDispatched when the user presses a key.InteractiveObject
 InheritedDispatched when the user attempts to change focus by using keyboard navigation.InteractiveObject
 InheritedDispatched 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
 InheritedDispatched when a user presses and releases the middle button of the user's pointing device over the same InteractiveObject.InteractiveObject
 InheritedDispatched when a user presses the middle pointing device button over an InteractiveObject instance.InteractiveObject
 InheritedDispatched when a user releases the pointing device button over an InteractiveObject instance.InteractiveObject
 InheritedDispatched when a user presses the pointing device button over an InteractiveObject instance.InteractiveObject
 InheritedDispatched when the user attempts to change focus by using a pointer device.InteractiveObject
 InheritedDispatched when a user moves the pointing device while it is over an InteractiveObject.InteractiveObject
 InheritedDispatched when the user moves a pointing device away from an InteractiveObject instance.InteractiveObject
 InheritedDispatched when the user moves a pointing device over an InteractiveObject instance.InteractiveObject
 InheritedDispatched when a user releases the pointing device button over an InteractiveObject instance.InteractiveObject
 InheritedDispatched when a mouse wheel is spun over an InteractiveObject instance.InteractiveObject
 InheritedDispatched by the drag initiator InteractiveObject when the user releases the drag gesture.InteractiveObject
 InheritedDispatched 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
 InheritedDispatched by an InteractiveObject when a drag gesture enters its boundary.InteractiveObject
 InheritedDispatched by an InteractiveObject when a drag gesture leaves its boundary.InteractiveObject
 InheritedDispatched by an InteractiveObject continually while a drag gesture remains within its boundary.InteractiveObject
 InheritedDispatched at the beginning of a drag operation by the InteractiveObject that is specified as the drag initiator in the DragManager.doDrag() call.InteractiveObject
 InheritedDispatched during a drag operation by the InteractiveObject that is specified as the drag initiator in the DragManager.doDrag() call.InteractiveObject
 InheritedDispatched when the user activates the platform-specific accelerator key combination for a paste operation or selects 'Paste' from the text context menu.InteractiveObject
 InheritedDispatched when the user lowers an active stylus past the proximity detection threshold of the screen.InteractiveObject
 Inherited
    proximityEnd
Dispatched when the user lifts an active stylus above the proximity detection threshold of the screen.InteractiveObject
 InheritedDispatched when the user moves an active stylus over the screen while remaining within the proximity detection threshold.InteractiveObject
 Inherited
    proximityOut
Dispatched when the user moves an active stylus away from this InteractiveObject while remaining within the proximity detection threshold of the screen.InteractiveObject
 InheritedDispatched when the user moves an active stylus directly above this InteractiveObject while remaining within the proximity detection threshold of the screen.InteractiveObject
 InheritedDispatched 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
 InheritedDispatched 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
 InheritedDispatched when a user releases the button on the pointing device after the user first pressed the button over an InteractiveObject instance and then moved the pointing device off of the InteractiveObject instance.InteractiveObject
 InheritedDispatched when a display object is about to be removed from the display list.DisplayObject
 InheritedDispatched 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
 Inherited[broadcast event] Dispatched when the display list is about to be updated and rendered.DisplayObject
 InheritedDispatched when a user presses and releases the right button of the user's pointing device over the same InteractiveObject.InteractiveObject
 InheritedDispatched when a user presses the pointing device button over an InteractiveObject instance.InteractiveObject
 InheritedDispatched when a user releases the pointing device button over an InteractiveObject instance.InteractiveObject
 InheritedDispatched when the user moves a pointing device away from an InteractiveObject instance.InteractiveObject
 InheritedDispatched when the user moves a pointing device over an InteractiveObject instance.InteractiveObject
  Dispatched by a TextField object after the user scrolls.TLFTextField
 InheritedDispatched 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
 InheritedDispatched immediately after the soft keyboard is raised.InteractiveObject
 InheritedDispatched immediately before the soft keyboard is raised.InteractiveObject
 InheritedDispatched immediately after the soft keyboard is lowered.InteractiveObject
 InheritedDispatched when the value of the object's tabChildren flag changes.InteractiveObject
 InheritedDispatched when the object's tabEnabled flag changes.InteractiveObject
 InheritedDispatched 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
 InheritedDispatched 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
 InheritedDispatched 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
 InheritedDispatched when the user touches the device, and is continuously dispatched until the point of contact is removed.InteractiveObject
 InheritedDispatched 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
 InheritedDispatched 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
 InheritedDispatched 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
 InheritedDispatched 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
 InheritedDispatched 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
Property Detail

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):void

Related 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 valueDescription
flash.text.AntiAliasType.NORMALApplies the regular text anti-aliasing. This matches the type of anti-aliasing that Flash Player 7 and earlier versions used.
flash.text.AntiAliasType.ADVANCEDApplies 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):void

Related 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):void

Throws
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):void

Related 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):void

Related 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):void

Related 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):void

Related 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):void

Related 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):void

Related 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):void

Related 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):void

Related 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():int

Related 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():int

Related 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):void

Related 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):void

Related 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):void

Related 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):void

Related 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):void

Related 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:

direction

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):void

Related 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):void

embedFonts

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):void

Related 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.

firstBaselineOffset1firstBaselineOffset2firstBaselineOffset3firstBaselineOffset4

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):void

Related 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 valueDescription
flash.text.GridFitType.NONESpecifies 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.PIXELSpecifies 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.SUBPIXELSpecifies 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):void

Related 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:
  • target: Specifies the name of the target window where you load the page. Options include _self, _blank, _parent, and _top. The _self option specifies the current frame in the current window, _blank specifies a new window, _parent specifies the parent of the current frame, and _top specifies the top-level frame in the current window.
  • href: Specifies a URL. The URL can be either absolute or relative to the location of the SWF file that is loading the page. An example of an absolute reference to a URL is http://www.adobe.com; an example of a relative reference is /index.html. Absolute URLs must be prefixed with http://; otherwise, Flash treats them as relative URLs. Note: Unlike the TextField class, ActionScript link events are not supported. Neither are a:link, a:hover, and a:active styles.
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:
  • color: Only hexadecimal color (#FFFFFF) values are supported.
  • face: Specifies the name of the font to use. As shown in the following example, you can specify a list of comma-delimited font names, in which case Flash Player selects the first available font. If the specified font is not installed on the local computer system or isn't embedded in the SWF file, Flash Player selects a substitute font.
  • size: Specifies the size of the font. You can use absolute pixel sizes, such as 16 or 18 or relative point sizes, such as +2 or -4.
  • letterspacing: Specifies the tracking (manual kerning) in pixels to be applied to the right of each character.
  • kerning: Specifies whether kerning is enabled or disabled. A non-zero value enables kerning, while zero disables it.
Image tag The <img> tag lets you embed external image files (JPEG, GIF, PNG), SWF files, and movie clips inside text.

The <img> tag supports the following attributes:

  • src: Specifies the URL to an image or SWF file, or the linkage identifier for a movie clip symbol in the library. This attribute is required; all other attributes are optional. External files (JPEG, GIF, PNG, and SWF files) do not show until they are downloaded completely.
  • width: The width of the image, SWF file, or movie clip being inserted, in pixels.
  • height: The height of the image, SWF file, or movie clip being inserted, in pixels.

Note: Unlike the TextField class, the following attributes are not supported: align, hspace, vspace, id, and checkPolicyFile.

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:
  • align: Specifies alignment of text within the paragraph; valid values are left, right, justify, and center.
  • class: Specifies a class name that can be used for styling
Span tag The <span> tag supports the following attributes:
  • class: Specifies a class name that can be used for styling.
  • You can also put properties directly in the span tag: <span fontFamily="Arial">Hi there</span>. However, nested span tags are not supported.
Text format tag

The <textformat> tag lets you use a subset of paragraph formatting properties of the TextFormat class within text fields, including line leading, indentation, margins, and tab stops. You can combine <textformat> tags with the built-in HTML tags.

The <textformat> tag has the following attributes:

  • indent: Specifies the indentation from the left margin to the first character in the paragraph; corresponds to TextFormat.indent. Both positive and negative numbers are acceptable.
  • blockindent: Specifies the indentation applied to all lines of the paragraph.
  • leftmargin: Specifies the left margin of the paragraph, in points; corresponds to TextFormat.leftMargin.
  • rightmargin: Specifies the right margin of the paragraph, in points; corresponds to TextFormat.rightMargin.
  • leading: Specifies the leading (line height) measured in pixels between a line's ascent and the previous line's descent
  • tabstops: Specifies a comma-separated list of tab stop positions for the paragraph.
Underline tag The <u> tag underlines the tagged text.

Flash also supports explicit character codes, such as &#38; (ASCII ampersand) and &#x20AC; (Unicode € symbol).



Implementation
    public function get htmlText():String
    public function set htmlText(value:String):void

Related API Elements

length

property 
length:int  [read-only]

Language Version: ActionScript 3.0
Product Version: Flash CS5
Runtime Versions: Flash Player 10, AIR 1.5

The number of characters in a text field. A character such as tab (\t) counts as one character.



Implementation
    public function get length():int

maxChars

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):void

maxScrollH

property 
maxScrollH:int  [read-only]

Language Version: ActionScript 3.0
Product Version: Flash CS5
Runtime Versions: Flash Player 10, AIR 1.5

The maximum value of scrollH.



Implementation
    public function get maxScrollH():int

Related API Elements

maxScrollV

property 
maxScrollV:int  [read-only]

Language Version: ActionScript 3.0
Product Version: Flash CS5
Runtime Versions: Flash Player 10, AIR 1.5

The maximum value of scrollV.



Implementation
    public function get maxScrollV():int

Related API Elements

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):void

multiline

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):void

Related 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():int

Related 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):void

Related 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):void

Related 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):void

Related 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):void

Related 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():String

pixelMaxScrollV

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():int

pixelScrollV

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):void

Related 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):void

scrollH

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):void

Related 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):void

Related 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):void

Related 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():int

Related 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():int

Related 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):void

styleSheet

property 
styleSheet:StyleSheet

Language Version: ActionScript 3.0
Product Version: Flash CS5
Runtime Versions: Flash Player 10, AIR 1.5

Style sheets for the TLF TextField.



Implementation
    public function get styleSheet():StyleSheet
    public function set styleSheet(value:StyleSheet):void

text

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):void

Related 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):void

textFlow

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):void

Related 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():Number

Related API Elements

textWidth

property 
textWidth:Number  [read-only]

Language Version: ActionScript 3.0
Product Version: Flash CS5
Runtime Versions: Flash Player 10, AIR 1.5

The width of the text in pixels. The right and left padding are not included in this value.



Implementation
    public function get textWidth():Number

Related API Elements

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):void

tlfMarkup

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):void

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):void

Throws
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):void

Related 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):void

Related 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):void

Related API Elements

Constructor Detail

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

Method Detail

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 

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).

Returns
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.

Returns
int — The zero-based index value of the character (for example, the first position is 0, the second position is 1, and so on). Returns -1 if the point is not over any character.

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).

Returns
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).

Returns
DisplayObject — The display object corresponding to the image or SWF file with the matching id attribute in the <img> tag of the text field. For media loaded from an external source, this object is a Loader object, and, once loaded, the media object is a child of that Loader object. For media embedded in the SWF file, it is the loaded object. If no <img> tag with the matching id exists, the method returns null.

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.

Returns
int — The zero-based index value of the line (for example, the first line is 0, the second line is 1, and so on). Returns -1 if the point is not over any line.

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).

Returns
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.

Returns
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.

Returns
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).

Returns
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).

Returns
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).

Returns
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:

UsageDescription
my_textField.getTextFormat()Returns a TextFormat object containing formatting information for all text in a text field. Only properties that are common to all text in the text field are set in the resulting TextFormat object. Any property that is mixed, meaning that it has different values at different points in the text, has a value of null.
my_textField.getTextFormat(beginIndex:Number)Returns a TextFormat object containing a copy of the text format of the character at the beginIndex position.
my_textField.getTextFormat(beginIndex:Number,endIndex:Number)Returns a TextFormat object containing formatting information for the span of text from beginIndex to endIndex-1. Only properties that are common to all of the text in the specified range are set in the resulting TextFormat object. Any property that is mixed (that is, has different values at different points in the range) has its value set to null.

Parameters

beginIndex:int (default = -1) — Optional; an integer that specifies the starting location of a range of text within the text field.
 
endIndex:int (default = -1) — Optional; an integer that specifies the position of the first character after the desired text span. As designed, if you specify beginIndex and endIndex values, the text from beginIndex to endIndex-1 is read.

Returns
flash.text:TextFormat — The TextFormat object that represents the formatting properties for the specified text.

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

Returns
Booleantrue 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.

UsageDescription
my_textField.setTextFormat(textFormat:TextFormat)Applies the properties of textFormat to all text in the text field.
my_textField.setTextFormat(textFormat:TextFormat, beginIndex:int)Applies the properties of textFormat to the text starting with the beginIndex position.
my_textField.setTextFormat(textFormat:TextFormat, beginIndex:int, endIndex:int)Applies the properties of the textFormat parameter to the span of text from the beginIndex position to the endIndex-1 position.

Notice that any text inserted manually by the user, or replaced by the replaceSelectedText() method, receives the default text field formatting for new text, and not the formatting specified for the text insertion point. To set a text field's default formatting for new text, use the defaultTextFormat property.


Throws
RangeError — The beginIndex or endIndex specified is out of range.

Related API Elements

Event Detail

change

Event
Event Object Type: flash.events.Event
property 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:

PropertyValue
bubblestrue
cancelablefalse; there is no default behavior to cancel.
currentTargetThe object that is actively processing the Event object with an event listener.
targetThe 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  
Event Object Type: flash.events.TextEvent
property 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.

Defines the value of the type property of a link event object.

This event has the following properties:

PropertyValue
bubblestrue
cancelablefalse; there is no default behavior to cancel.
currentTargetThe object that is actively processing the Event object with an event listener.
targetThe 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.
textThe remainder of the URL after "event:"

scroll

Event  
Event Object Type: flash.events.Event
property 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.

The Event.SCROLL constant defines the value of the type property of a scroll event object.

This event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
currentTargetThe object that is actively processing the Event object with an event listener.
targetThe 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  
Event Object Type: flash.events.TextEvent
property 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.

Defines the value of the 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:

PropertyValue
bubblestrue
cancelabletrue; call the preventDefault() method to cancel default behavior.
currentTargetThe object that is actively processing the Event object with an event listener.
targetThe 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.
textThe character or sequence of characters entered by the user.