Package | fl.text |
Class | public class TLFTextField |
Inheritance | TLFTextField ![]() ![]() ![]() ![]() ![]() ![]() |
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS5 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Create a TLFTextField object the same way you create a text field with the TextField class. Then, use
the textFlow
property to assign advanced formatting from the TLF classes. For example:
import fl.text.TLFTextField; import flashx.textLayout.formats.TextLayoutFormat; import flashx.textLayout.elements.TextFlow; var myTLFTextField:TLFTextField = new TLFTextField(); addChild(myTLFTextField); myTLFTextField.x = 10; myTLFTextField.y = 10; myTLFTextField.width = 200 myTLFTextField.height = 100; myTLFTextField.text = "This is my text"; var myFormat:TextLayoutFormat = new TextLayoutFormat(); myFormat.textIndent = 8; myFormat.color = 0x336633; myFormat.fontFamily = "Arial, Helvetica, _sans"; myFormat.fontSize = 24; var myTextFlow:TextFlow = myTLFTextField.textFlow; myTextFlow.hostFormat = myFormat; myTextFlow.flowComposer.updateAllControllers();
More examples
Formatting text with TLF
Importing and exporting text with TLF
Managing text containers with TLF
Enabling text selection, editing, and undo with TLF
Event handling with TLF
Learn more
Related API Elements
Property | Defined By | ||
---|---|---|---|
![]() | accessibilityImplementation : AccessibilityImplementation
The current accessibility implementation (AccessibilityImplementation)
for this InteractiveObject instance. | InteractiveObject | |
![]() | accessibilityProperties : AccessibilityProperties
The current accessibility options for this display object. | DisplayObject | |
![]() | alpha : Number
Indicates the alpha transparency value of the object specified. | DisplayObject | |
alwaysShowSelection : Boolean
When set to true and the text field is not in focus, Flash Player highlights the
selection in the text field in light blue. | TLFTextField | ||
antiAliasType : String
The type of anti-aliasing used for this text field. | TLFTextField | ||
autoSize : String
Controls automatic sizing and alignment of text fields. | TLFTextField | ||
background : Boolean
Specifies whether the text field has a background fill. | TLFTextField | ||
backgroundAlpha : Number
Specifies the alpha value of the text field background. | TLFTextField | ||
backgroundColor : uint
Specifies the color of the text field background. | TLFTextField | ||
![]() | blendMode : String
A value from the BlendMode class that specifies which blend mode to use. | DisplayObject | |
![]() | blendShader : Shader [write-only]
Sets a shader that is used for blending the foreground and background. | DisplayObject | |
border : Boolean
Specifies whether the text field has a border. | TLFTextField | ||
borderAlpha : Number
Specifies the alpha value of the border. | TLFTextField | ||
borderColor : uint
Specifies the color of the text field border. | TLFTextField | ||
borderWidth : Number
Specifies the width of the border. | TLFTextField | ||
bottomScrollV : int [read-only]
An integer (1-based index) that indicates the bottommost line that is currently visible in
the specified text field. | TLFTextField | ||
![]() | buttonMode : Boolean
Specifies the button mode of this sprite. | Sprite | |
![]() | cacheAsBitmap : Boolean
If set to true, Flash runtimes cache an internal bitmap representation of the
display object. | DisplayObject | |
![]() | cacheAsBitmapMatrix : Matrix
If non-null, this Matrix object defines how a display object is rendered when
cacheAsBitmap is set to true. | DisplayObject | |
caretIndex : int [read-only]
The index of the insertion point (caret) position. | TLFTextField | ||
columnCount : Object
Number of text columns (adopts default value if undefined during cascade). | TLFTextField | ||
columnGap : Object
Specifies the amount of gutter space, in pixels, to leave between the columns (adopts default value if undefined during cascade). | TLFTextField | ||
![]() | constructor : Object
A reference to the class object or constructor function for a given object instance. | Object | |
![]() | contextMenu : NativeMenu
Specifies the context menu associated with this object. | InteractiveObject | |
![]() | doubleClickEnabled : Boolean
Specifies whether the object receives doubleClick events. | InteractiveObject | |
![]() | dropTarget : DisplayObject [read-only]
Specifies the display object over which the sprite is being dragged, or on
which the sprite was dropped. | Sprite | |
![]() | filters : Array
An indexed array that contains each filter object currently associated with the display object. | DisplayObject | |
![]() | focusRect : Object
Specifies whether this object displays a focus rectangle. | InteractiveObject | |
![]() | graphics : Graphics [read-only]
Specifies the Graphics object that belongs to this sprite where vector
drawing commands can occur. | Sprite | |
![]() | height : Number
Indicates the height of the display object, in pixels. | DisplayObject | |
![]() | hitArea : Sprite
Designates another sprite to serve as the hit area for a sprite. | Sprite | |
![]() | loaderInfo : LoaderInfo [read-only]
Returns a LoaderInfo object containing information about loading the file
to which this display object belongs. | DisplayObject | |
![]() | mask : DisplayObject
The calling display object is masked by the specified mask object. | DisplayObject | |
![]() | metaData : 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 | |
![]() | mouseChildren : Boolean
Determines whether or not the children of the object are mouse, or user input device, enabled. | DisplayObjectContainer | |
![]() | mouseEnabled : Boolean
Specifies whether this object receives mouse, or other user input, messages. | InteractiveObject | |
![]() | mouseX : Number [read-only]
Indicates the x coordinate of the mouse or user input device position, in pixels. | DisplayObject | |
![]() | mouseY : Number [read-only]
Indicates the y coordinate of the mouse or user input device position, in pixels. | DisplayObject | |
![]() | name : String
Indicates the instance name of the DisplayObject. | DisplayObject | |
![]() | needsSoftKeyboard : Boolean
Specifies whether a virtual keyboard (an on-screen, software keyboard) should display
when this InteractiveObject instance receives focus. | InteractiveObject | |
![]() | numChildren : int [read-only]
Returns the number of children of this object. | DisplayObjectContainer | |
![]() | opaqueBackground : Object
Specifies whether the display object is opaque with a certain background color. | DisplayObject | |
![]() | parent : DisplayObjectContainer [read-only]
Indicates the DisplayObjectContainer object that contains this display object. | DisplayObject | |
![]() | root : DisplayObject [read-only]
For a display object in a loaded SWF file, the root property is the
top-most display object in the portion of the display list's tree structure represented by that SWF file. | DisplayObject | |
![]() | rotation : Number
Indicates the rotation of the DisplayObject instance, in degrees, from its original orientation. | DisplayObject | |
![]() | rotationX : Number
Indicates the x-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container. | DisplayObject | |
![]() | rotationY : Number
Indicates the y-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container. | DisplayObject | |
![]() | rotationZ : Number
Indicates the z-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container. | DisplayObject | |
![]() | scale9Grid : Rectangle
The current scaling grid that is in effect. | DisplayObject | |
![]() | scaleX : Number
Indicates the horizontal scale (percentage) of the object as applied from the registration point. | DisplayObject | |
![]() | scaleY : Number
Indicates the vertical scale (percentage) of an object as applied from the registration point of the object. | DisplayObject | |
![]() | scaleZ : Number
Indicates the depth scale (percentage) of an object as applied from the registration point of the object. | DisplayObject | |
![]() | scrollRect : Rectangle
The scroll rectangle bounds of the display object. | DisplayObject | |
![]() | softKeyboard : String
Controls the appearance of the soft keyboard. | InteractiveObject | |
![]() | softKeyboardInputAreaOfInterest : Rectangle
Defines the area that should remain on-screen when a soft keyboard is displayed (not available on iOS). | InteractiveObject | |
![]() | soundTransform : flash.media:SoundTransform
Controls sound within this sprite. | Sprite | |
![]() | stage : Stage [read-only]
The Stage of the display object. | DisplayObject | |
![]() | tabChildren : Boolean
Determines whether the children of the object are tab enabled. | DisplayObjectContainer | |
![]() | tabEnabled : Boolean
Specifies whether this object is in the tab order. | InteractiveObject | |
![]() | tabIndex : int
Specifies the tab ordering of objects in a SWF file. | InteractiveObject | |
![]() | textSnapshot : flash.text:TextSnapshot [read-only]
Returns a TextSnapshot object for this DisplayObjectContainer instance. | DisplayObjectContainer | |
![]() | transform : flash.geom:Transform
An object with properties pertaining to a display object's matrix, color transform, and pixel bounds. | DisplayObject | |
![]() | useHandCursor : Boolean
A Boolean value that indicates whether the pointing hand (hand cursor) appears when the pointer rolls
over a sprite in which the buttonMode property is set to true. | Sprite | |
![]() | visible : Boolean
Whether or not the display object is visible. | DisplayObject | |
![]() | width : Number
Indicates the width of the display object, in pixels. | DisplayObject | |
![]() | x : Number
Indicates the x coordinate of the DisplayObject instance relative to the local coordinates of
the parent DisplayObjectContainer. | DisplayObject | |
![]() | y : Number
Indicates the y coordinate of the DisplayObject instance relative to the local coordinates of
the parent DisplayObjectContainer. | DisplayObject | |
![]() | z : Number
Indicates the z coordinate position along the z-axis of the DisplayObject
instance relative to the 3D parent container. | DisplayObject |
Method | Defined By | ||
---|---|---|---|
![]() |
Adds a child DisplayObject instance to this DisplayObjectContainer instance. | DisplayObjectContainer | |
![]() |
Adds a child DisplayObject instance to this DisplayObjectContainer
instance. | DisplayObjectContainer | |
![]() | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener
receives notification of an event. | EventDispatcher | |
![]() |
Indicates whether the security restrictions
would cause any display objects to be omitted from the list returned by calling
the DisplayObjectContainer.getObjectsUnderPoint() method
with the specified point point. | DisplayObjectContainer | |
![]() |
Determines whether the specified display object is a child of the DisplayObjectContainer instance or
the instance itself. | DisplayObjectContainer | |
![]() |
Dispatches an event into the event flow. | EventDispatcher | |
![]() |
Returns a rectangle that defines the area of the display object relative to the coordinate system
of the targetCoordinateSpace object. | DisplayObject | |
![]() |
Returns the child display object instance that exists at the specified index. | DisplayObjectContainer | |
![]() |
Returns the child display object that exists with the specified name. | DisplayObjectContainer | |
![]() |
Returns the index position of a child DisplayObject instance. | DisplayObjectContainer | |
![]() |
Returns an array of objects that lie under the specified point and are children
(or grandchildren, and so on) of this DisplayObjectContainer instance. | DisplayObjectContainer | |
![]() |
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 | |
![]() |
Converts the point object from the Stage (global) coordinates
to the display object's (local) coordinates. | DisplayObject | |
![]() |
Converts a two-dimensional point from the Stage (global) coordinates to a
three-dimensional display object's (local) coordinates. | DisplayObject | |
![]() |
Checks whether the EventDispatcher object has any listeners registered for a specific type
of event. | EventDispatcher | |
![]() |
Indicates whether an object has a specified property defined. | Object | |
![]() |
Evaluates the bounding box of the display object to see if it overlaps or intersects with the
bounding box of the obj display object. | DisplayObject | |
![]() |
Evaluates the display object to see if it overlaps or intersects with the
point specified by the x and y parameters. | DisplayObject | |
![]() |
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | |
![]() |
Converts a three-dimensional point of the three-dimensional display
object's (local) coordinates to a two-dimensional point in the Stage (global) coordinates. | DisplayObject | |
![]() |
Converts the point object from the display object's (local) coordinates to the
Stage (global) coordinates. | DisplayObject | |
![]() |
Indicates whether the specified property exists and is enumerable. | Object | |
![]() |
Removes the specified child DisplayObject instance from the child list of the DisplayObjectContainer instance. | DisplayObjectContainer | |
![]() |
Removes a child DisplayObject from the specified index position in the child list of
the DisplayObjectContainer. | DisplayObjectContainer | |
![]() |
Removes all child DisplayObject instances from the child list of the DisplayObjectContainer instance. | DisplayObjectContainer | |
![]() |
Removes a listener from the EventDispatcher object. | EventDispatcher | |
![]() |
Raises a virtual keyboard. | InteractiveObject | |
![]() |
Changes the position of an existing child in the display object container. | DisplayObjectContainer | |
![]() |
Sets the availability of a dynamic property for loop operations. | Object | |
![]() |
Lets the user drag the specified sprite. | Sprite | |
![]() |
Lets the user drag the specified sprite on a touch-enabled device. | Sprite | |
![]() |
Recursively stops the timeline execution of all MovieClips rooted at this object. | DisplayObjectContainer | |
![]() |
Ends the startDrag() method. | Sprite | |
![]() |
Ends the startTouchDrag() method, for use with touch-enabled devices. | Sprite | |
![]() |
Swaps the z-order (front-to-back order) of the two specified child objects. | DisplayObjectContainer | |
![]() |
Swaps the z-order (front-to-back order) of the child objects at the two specified index positions in the
child list. | DisplayObjectContainer | |
![]() |
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | |
![]() |
Returns the string representation of the specified object. | Object | |
![]() |
Returns the primitive value of the specified object. | Object | |
![]() |
Checks whether an event listener is registered with this EventDispatcher object or any of
its ancestors for the specified event type. | EventDispatcher |
Event | Summary | Defined By | ||
---|---|---|---|---|
![]() | [broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active. | EventDispatcher | ||
![]() | Dispatched when a display object is added to the display list. | DisplayObject | ||
![]() | Dispatched when a display object is added to the on stage display list, either directly or through the addition of a sub tree in which the display object is contained. | DisplayObject | ||
![]() | Dispatched when the user selects 'Clear' (or 'Delete') from the text context menu. | InteractiveObject | ||
![]() | Dispatched when a user presses and releases the main button of the user's pointing device over the same InteractiveObject. | InteractiveObject | ||
![]() | Dispatched when a user gesture triggers the context menu associated with this interactive object in an AIR application. | InteractiveObject | ||
![]() | Dispatched when the user activates the platform-specific accelerator key combination for a copy operation or selects 'Copy' from the text context menu. | InteractiveObject | ||
![]() | Dispatched when the user activates the platform-specific accelerator key combination for a cut operation or selects 'Cut' from the text context menu. | InteractiveObject | ||
![]() | [broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive. | EventDispatcher | ||
![]() | Dispatched when a user presses and releases the main button of a pointing device twice in rapid succession over the same InteractiveObject when that object's doubleClickEnabled flag is set to true. | InteractiveObject | ||
![]() | [broadcast event] Dispatched when the playhead is entering a new frame. | DisplayObject | ||
![]() | [broadcast event] Dispatched when the playhead is exiting the current frame. | DisplayObject | ||
![]() | Dispatched after a display object gains focus. | InteractiveObject | ||
![]() | Dispatched after a display object loses focus. | InteractiveObject | ||
![]() | [broadcast event] Dispatched after the constructors of frame display objects have run but before frame scripts have run. | DisplayObject | ||
![]() | Dispatched when the user creates a point of contact along the edge of the touch surface with an InteractiveObject instance, (such as tapping along the edge of the touch surface on Siri Remote for Apple TV) Some devices might also interpret this contact as a combination of several touch events, as well. | InteractiveObject | ||
![]() | Dispatched when the user presses two points of contact over the same InteractiveObject instance on a touch-enabled device (such as presses and releases two fingers over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | ||
![]() | Dispatched when the user moves a point of contact over the InteractiveObject instance on a touch-enabled device (such as moving a finger from left to right over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | ||
![]() | Dispatched when the user performs a rotation gesture at a point of contact with an InteractiveObject instance (such as touching two fingers and rotating them over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | ||
![]() | Dispatched when the user performs a swipe gesture at a point of contact with an InteractiveObject instance (such as touching three fingers to a screen and then moving them in parallel over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | ||
![]() | Dispatched when the user creates a point of contact with an InteractiveObject instance, then taps on a touch-enabled device (such as placing several fingers over a display object to open a menu and then taps one finger to select a menu item on a mobile phone or tablet with a touch screen). | InteractiveObject | ||
![]() | Dispatched when the user performs a zoom gesture at a point of contact with an InteractiveObject instance (such as touching two fingers to a screen and then quickly spreading the fingers apart over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | ||
![]() | This event is dispatched to any client app that supports inline input with an IME | InteractiveObject | ||
![]() | Dispatched when the user presses a key. | InteractiveObject | ||
![]() | Dispatched when the user attempts to change focus by using keyboard navigation. | InteractiveObject | ||
![]() | Dispatched when the user releases a key. | InteractiveObject | ||
![]() | Dispatched when a user presses and releases the middle button of the user's pointing device over the same InteractiveObject. | InteractiveObject | ||
![]() | Dispatched when a user presses the middle pointing device button over an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when a user releases the pointing device button over an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when a user presses the pointing device button over an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when the user attempts to change focus by using a pointer device. | InteractiveObject | ||
![]() | Dispatched when a user moves the pointing device while it is over an InteractiveObject. | InteractiveObject | ||
![]() | Dispatched when the user moves a pointing device away from an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when the user moves a pointing device over an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when a user releases the pointing device button over an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when a mouse wheel is spun over an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched by the drag initiator InteractiveObject when the user releases the drag gesture. | InteractiveObject | ||
![]() | Dispatched by the target InteractiveObject when a dragged object is dropped on it and the drop has been accepted with a call to DragManager.acceptDragDrop(). | InteractiveObject | ||
![]() | Dispatched by an InteractiveObject when a drag gesture enters its boundary. | InteractiveObject | ||
![]() | Dispatched by an InteractiveObject when a drag gesture leaves its boundary. | InteractiveObject | ||
![]() | Dispatched by an InteractiveObject continually while a drag gesture remains within its boundary. | InteractiveObject | ||
![]() | Dispatched at the beginning of a drag operation by the InteractiveObject that is specified as the drag initiator in the DragManager.doDrag() call. | InteractiveObject | ||
![]() | Dispatched during a drag operation by the InteractiveObject that is specified as the drag initiator in the DragManager.doDrag() call. | InteractiveObject | ||
![]() | Dispatched when the user activates the platform-specific accelerator key combination for a paste operation or selects 'Paste' from the text context menu. | InteractiveObject | ||
![]() | Dispatched when the user lowers an active stylus past the proximity detection threshold of the screen. | InteractiveObject | ||
![]() | Dispatched when the user lifts an active stylus above the proximity detection threshold of the screen. | InteractiveObject | ||
![]() | Dispatched when the user moves an active stylus over the screen while remaining within the proximity detection threshold. | InteractiveObject | ||
![]() | Dispatched when the user moves an active stylus away from this InteractiveObject while remaining within the proximity detection threshold of the screen. | InteractiveObject | ||
![]() | Dispatched when the user moves an active stylus directly above this InteractiveObject while remaining within the proximity detection threshold of the screen. | InteractiveObject | ||
![]() | Dispatched when the user moves an active stylus away from this InteractiveObject and any of its children while remaining within the proximity detection threshold of the screen. | InteractiveObject | ||
![]() | Dispatched when the user moves an active stylus over this InteractiveObject from outside the object's tree of descendents in the display list (while remaining within the proximity detection threshold of the screen). | InteractiveObject | ||
![]() | Dispatched when a 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 | ||
![]() | Dispatched when a display object is about to be removed from the display list. | DisplayObject | ||
![]() | Dispatched when a display object is about to be removed from the display list, either directly or through the removal of a sub tree in which the display object is contained. | DisplayObject | ||
![]() | [broadcast event] Dispatched when the display list is about to be updated and rendered. | DisplayObject | ||
![]() | Dispatched when a user presses and releases the right button of the user's pointing device over the same InteractiveObject. | InteractiveObject | ||
![]() | Dispatched when a user presses the pointing device button over an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when a user releases the pointing device button over an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when the user moves a pointing device away from an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when the user moves a pointing device over an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when the user activates the platform-specific accelerator key combination for a select all operation or selects 'Select All' from the text context menu. | InteractiveObject | ||
![]() | Dispatched immediately after the soft keyboard is raised. | InteractiveObject | ||
![]() | Dispatched immediately before the soft keyboard is raised. | InteractiveObject | ||
![]() | Dispatched immediately after the soft keyboard is lowered. | InteractiveObject | ||
![]() | Dispatched when the value of the object's tabChildren flag changes. | InteractiveObject | ||
![]() | Dispatched when the object's tabEnabled flag changes. | InteractiveObject | ||
![]() | Dispatched when the value of the object's tabIndex property changes. | InteractiveObject | ||
![]() | Dispatched when the user first contacts a touch-enabled device (such as touches a finger to a mobile phone or tablet with a touch screen). | InteractiveObject | ||
![]() | Dispatched when the user removes contact with a touch-enabled device (such as lifts a finger off a mobile phone or tablet with a touch screen). | InteractiveObject | ||
![]() | Dispatched when the user touches the device, and is continuously dispatched until the point of contact is removed. | InteractiveObject | ||
![]() | Dispatched when the user moves the point of contact away from InteractiveObject instance on a touch-enabled device (such as drags a finger from one display object to another on a mobile phone or tablet with a touch screen). | InteractiveObject | ||
![]() | Dispatched when the user moves the point of contact over an InteractiveObject instance on a touch-enabled device (such as drags a finger from a point outside a display object to a point over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | ||
![]() | Dispatched when the user moves the point of contact away from an InteractiveObject instance on a touch-enabled device (such as drags a finger from over a display object to a point outside the display object on a mobile phone or tablet with a touch screen). | InteractiveObject | ||
![]() | Dispatched when the user moves the point of contact over an InteractiveObject instance on a touch-enabled device (such as drags a finger from a point outside a display object to a point over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | ||
![]() | Dispatched when the user lifts the point of contact over the same InteractiveObject instance on which the contact was initiated on a touch-enabled device (such as presses and releases a finger from a single point over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject |
alwaysShowSelection | property |
alwaysShowSelection:Boolean
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
When set to true
and the text field is not in focus, Flash Player highlights the
selection in the text field in light blue. When set to false
and the text field is not in
focus, Flash Player does not highlight the selection in the text field.
Example:
package { import flash.display.Sprite; import fl.text.TLFTextField; import flash.text.TextFieldType; public class TLFTextField_alwaysShowSelection extends Sprite { public function TLFTextField_alwaysShowSelection() { var label1:TLFTextField = createTLFTextField(0, 20, 200, 20); label1.text = "This text is selected."; label1.setSelection(0, 9); label1.alwaysShowSelection = true; var label2:TLFTextField = createTLFTextField(0, 50, 200, 20); label2.text = "Drag to select some of this text."; } private function createTLFTextField(x:Number, y:Number, width:Number, height:Number):TLFTextField { var result:TLFTextField = new TLFTextField(); result.x = x; result.y = y; result.width = width; result.height = height; addChild(result); return result; } } }
The default value is false.
Implementation
public function get alwaysShowSelection():Boolean
public function set alwaysShowSelection(value:Boolean):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 value | Description |
---|---|
flash.text.AntiAliasType.NORMAL | Applies the regular text anti-aliasing. This matches the type of anti-aliasing that Flash Player 7 and earlier versions used. |
flash.text.AntiAliasType.ADVANCED | Applies advanced anti-aliasing, which makes text more legible. (This feature became available in Flash Player 8.) Advanced anti-aliasing allows for high-quality rendering of font faces at small sizes. It is best used with applications that have a lot of small text. Advanced anti-aliasing is not recommended for fonts that are larger than 48 points. |
The default value is flash.text.AntiAliasType.NORMAL.
Implementation
public function get antiAliasType():String
public function set antiAliasType(value:String):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
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
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
createTextLayoutFormat | () | method |
tlf_internal static function createTextLayoutFormat(format:flash.text:TextFormat):flashx.textLayout.formats:TextLayoutFormat
Parameters
format:flash.text:TextFormat |
flashx.textLayout.formats:TextLayoutFormat |
Wed Nov 21 2018, 06:34 AM -08:00