flash.text.engine

# TabStop - AS3

Package | flash.text.engine
Class | public final class TabStop
Inheritance | TabStop Object

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5, Flash Lite 4

The TabStop class represents the properties of a tab stop in a text block. You assign tab stops as a Vector of TabStop objects to the `TextBlock.tabStops` property.

Setting the properties of a TabStop object after you apply it to a TextBlock does not invalidate the TextBlock.

View the examples

More examples

Tab stops

Related API Elements

TextBlock.tabStops
TabAlignment

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | alignment : String Specifies the tab alignment for this tab stop. | TabStop
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object
|  | decimalAlignmentToken : String Specifies the alignment token to use when you set the alignment property to TabAlignment.DECIMAL. | TabStop
|  | position : Number The position of the tab stop, in pixels, relative to the start of the text line. | TabStop

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | TabStop(alignment:String = "start", position:Number = 0.0, decimalAlignmentToken:String = "") Creates a new TabStop. | TabStop
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | toLocaleString():String Returns the string representation of this object, formatted according to locale-specific conventions. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | valueOf():Object Returns the primitive value of the specified object. | Object

Property Detail

### alignment

property

`alignment:String`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5, Flash Lite 4

Specifies the tab alignment for this tab stop. Use the constants in the TabAlignment class to set this property.

The default value is `TabAlignment.START`.

Use the `lineOffset` argument to `TextBlock.createTextLine()` to adjust the tabs if the origin of the line does not align with other lines that share the same tab stops.

Use the following constants from the TabAlignment class to set the value for this property:

String value | Description
--- | ---
`TabAlignment.START` | The `position` property specifies the number of pixels that the start of the tabbed text is from the start of the text line.
`TabAlignment.CENTER` | The `position` property specifies the number of pixels that the center of the tabbed text is from the start of the text line.
`TabAlignment.END` | The `position` property specifies the number of pixels that the end of the tabbed text is from the start of the text line.
`TabAlignment.DECIMAL` | The `position` property specifies the number of pixels that the alignment token is from the start of the text line.

Implementation
`public function get alignment():String`
`public function set alignment(value:String):void`
Throws

| `ArgumentError` — If set to any value that is not a member of `TabAlignment`.

Related API Elements

TabAlignment
TextBlock.createTextLine()

### decimalAlignmentToken

property

`decimalAlignmentToken:String`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5, Flash Lite 4

Specifies the alignment token to use when you set the `alignment` property to `TabAlignment.DECIMAL`. The value is a String that occurs in the text line.

The default value is `""`.

Implementation
`public function get decimalAlignmentToken():String`
`public function set decimalAlignmentToken(value:String):void`

Related API Elements

TabAlignment.DECIMAL

### position

property

`position:Number`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5, Flash Lite 4

The position of the tab stop, in pixels, relative to the start of the text line.

The default value is 0.0.

Implementation
`public function get position():Number`
`public function set position(value:Number):void`
Throws

| `ArgumentError` — If set to a value less than 0.0.

Constructor Detail

### TabStop

()
Constructor

`public function TabStop(alignment:String = "start", position:Number = 0.0, decimalAlignmentToken:String = "")`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5, Flash Lite 4

Creates a new TabStop.

Parameters

| `alignment:String` (default = "`start`")`` — The tab alignment type of this tab stop. Valid values for this property are found in the members of the `TabAlignment` class. The default value is `TabAlignment.START`.
| `position:Number` (default = `0.0`)`` — The position of the tab stop, in pixels. The default value is `0.0`.
| `decimalAlignmentToken:String` (default = "``")`` — The alignment token to be used if the `alignment` is `TabAlignment.DECIMAL`, The default value is `""`.

Throws

| `ArgumentError` — The `alignment` specified is not a member of `TabAlignment`.

Related API Elements

TabAlignment
Examples How to use this example
TabStopExample.as
This example illustrates the effects of the four tab stop alignment settings - START, CENTER, DECIMAL, and END.
Copy

    package {

        import flash.text.engine.*;
        import flash.display.Sprite;

        public class TabStopExample extends Sprite {

            public function TabStopExample():void {
                var container:Sprite = new Sprite();

                var english:ElementFormat = new ElementFormat();
                english.fontDescription = new FontDescription("Arial");
                english.fontSize = 16;
                english.locale = "en";

                var tabStops:Vector.<TabStop> = new Vector.<TabStop>();
                tabStops.push(
                    new TabStop(TabAlignment.START, 20),
                    new TabStop(TabAlignment.CENTER, 120),
                    new TabStop(TabAlignment.DECIMAL, 220, "."),
                    new TabStop(TabAlignment.END, 320)
                );

                var textBlock:TextBlock = new TextBlock();
                textBlock.content = new TextElement(
                    "\tstart\tcenter\tdeci.mal\tend\n" +
                    "\tl\tl\t3.4\tl\n" +
                    "\tlm\tlm\t234.56\tlm\n" +
                    "\tlmn\tlmn\t12345678.34567\tlmn\n"
                    , english);
                textBlock.tabStops = tabStops;
                var y:Number = 60;
                var previousTextLine:TextLine = null;
                var textLine:TextLine;
                var i:int;
                var tabOrigin:Number = 100;
                for (i = 0; i < 4; i++) {
                    textLine = textBlock.createTextLine(previousTextLine, 1000, 0);
                    textLine.x = 20;
                    textLine.y = y;

                    container.addChild(textLine);

                    y += 25;
                    previousTextLine = textLine;
                }
                addChild(container);
            }
        }
    }

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00