Adobe® Flex® 4 Language Reference
Show Packages and Classes List |  Packages  |  Classes  |  Index  |  Appendixes
flash.text.engine 
TabStop 
Packageflash.text.engine
Classpublic final class TabStop
InheritanceTabStop Inheritance 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

See also



Public Properties
 PropertyDefined By
  alignment : String
Specifies the tab alignment for this tab stop.
TabStop
 Inheritedconstructor : 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
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
Public Methods
 MethodDefined By
  
TabStop(alignment:String = "start", position:Number = 0.0, decimalAlignmentToken:String = "")
Creates a new TabStop.
TabStop
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 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
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 valueDescription
TabAlignment.STARTThe position property specifies the number of pixels that the start of the tabbed text is from the start of the text line.
TabAlignment.CENTERThe position property specifies the number of pixels that the center of the tabbed text is from the start of the text line.
TabAlignment.ENDThe position property specifies the number of pixels that the end of the tabbed text is from the start of the text line.
TabAlignment.DECIMALThe 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.

See also

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

See also

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.

See also

TabStopExample.as

This example illustrates the effects of the four tab stop alignment settings - START, CENTER, DECIMAL, and END.
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);        
        }
    }
}