ActionScript 3.0 Language and Components Reference | All Packages | All Classes | Language Elements | Index | Appendixes | Conventions | Frames No Frames |
TabStop

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

Language Version : | ActionScript 3.0

Player Version : | Flash Player 10

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

See also

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
|  | prototype : Object [static] A reference to the prototype object of a class or function object. | Object

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | TabStop(alignment:String = "start", position:Number = 0.0, decimalAlignmentToken:String = null) 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
|  | 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` [read-write]

Language Version : | ActionScript 3.0

Player Version : | Flash Player 10

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 will be from the start of the text line.
`TabAlignment.CENTER` | The `position` property specifies the number of pixels that the center of the tabbed text will be from the start of the text line.
`TabAlignment.END` | The `position` property specifies the number of pixels that the end of the tabbed text will be from the start of the text line.
`TabAlignment.DECIMAL` | The `position` property specifies the number of pixels that the alignment token will be 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`.

See also

TabAlignment
TextBlock.createTextLine

decimalAlignmentToken | property |

`decimalAlignmentToken:String` [read-write]

Language Version : | ActionScript 3.0

Player Version : | Flash Player 10

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 `null`.

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

See also

TabAlignment.DECIMAL

position | property |

`position:Number` [read-write]

Language Version : | ActionScript 3.0

Player Version : | Flash Player 10

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 = null)`

Language Version : | ActionScript 3.0

Player Version : | Flash Player 10

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 = `null`)`` — The alignment token to be used if the `alignment` is `TabAlignment.DECIMAL`, The default value is `null`.

Throws

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

See also

TabAlignment
Examples How to use examples
TabStopExample.as
The following example creates a series of tab stops, 20 pixels apart, for a TextBlock. Note that this example illustrates how to set tabstops for a TextBlock but is artificial to the extent that you would typically use tabstops for text input.

    package {
        import flash.display.Sprite;
        import flash.text.engine.FontDescription;
        import flash.text.engine.TextBlock;
        import flash.text.engine.TextLine;
        import flash.text.engine.TextElement;
        import flash.text.engine.ElementFormat;
        import flash.text.engine.TabStop;
        import flash.text.engine.TabAlignment;

        public class TabStopExample extends Sprite {

            public function TabStopExample():void {
                var tabSize:Number = 20;
                var tabNumber:Number = 4;
                var fontDescription:FontDescription = new FontDescription("Verdana");
                var format:ElementFormat = new ElementFormat(fontDescription);
                var textElement:TextElement = new TextElement(null, format);
                var tabStop:TabStop = new TabStop();
                var textBlock:TextBlock = new TextBlock();
                var tabs:Vector.<TabStop> = new Vector.<TabStop>();
                var i = 0;
                var lineYpos:Number = 0;
                var textLine:TextLine = null;
                while(i < tabNumber)
                {
                    tabs.push(tabStop);
                    tabStop.position += tabSize;
                    textElement.text = "tabstop #" + i + " is at position: " + tabStop.position;
                    lineYpos += 15;
                    textBlock.content = textElement;
                    var newLine:TextLine = textBlock.createTextLine(textLine, 200);
                    addChild(newLine);
                    newLine.x = tabStop.position;
                    newLine.y = lineYpos ;
                    ++i;
                }
                textBlock.tabStops = tabs;
            }
        }
    }

Submit Feedback on LiveDocs
© 2004-2008 Adobe Systems Incorporated. All rights reserved.
Tue May 20 2008, 04:02 AM -07:00