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 |
TextBlock.tabStops
property.
Setting the properties of a TabStop object after you apply it to a TextBlock does not invalidate the TextBlock.
More examples
Related API Elements
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 |
Method | Defined By | ||
---|---|---|---|
Creates a new TabStop. | TabStop | ||
Indicates whether an object has a specified property defined. | Object | ||
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | ||
Indicates whether the specified property exists and is enumerable. | Object | ||
Sets the availability of a dynamic property for loop operations. | Object | ||
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 |
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
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
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.
|
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.
Parametersalignment: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
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); } } }
Thu Dec 6 2018, 01:12 PM -08:00