| Package | flash.text.engine |
| Class | public final class TabStop |
| Inheritance | TabStop Object |
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 10 |
TextBlock.tabStops property.
Setting the properties of a TabStop object after you apply it to a TextBlock does not invalidate the TextBlock.
See also
| 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 | |
| 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 the specified object. | Object | |
![]() |
Returns the primitive value of the specified object. | Object | |
| 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. |
public function get alignment():String public function set alignment(value:String):voidArgumentError — If set to any value that is not a member of TabAlignment.
|
See also
| 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.
public function get decimalAlignmentToken():String public function set decimalAlignmentToken(value:String):voidSee also
| 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.
public function get position():Number public function set position(value:Number):voidArgumentError — If set to a value less than 0.0.
|
| 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.
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 = null) — The alignment token to be used if the alignment is TabAlignment.DECIMAL,
The default value is null.
|
ArgumentError — The alignment specified is not a member of TabAlignment.
|
See also
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;
}
}
}