| Package | com.esri.ags.symbol |
| Class | public class TextSymbol |
| Inheritance | TextSymbol Symbol flash.events.EventDispatcher |
The actual text can be set using the following properties: htmlText, text, textAttribute or textFunction.
Note: Changing alpha and angle only works with embedded fonts.
Default MXML PropertytextFormat
<esri:TextSymbol id="ts1" text="Verdana with color" placement="middle">
<flash:TextFormat font="Verdana" color="0xFF00FF" bold="true" underline="true"/>
</esri:TextSymbol>
<flash:TextFormat id="ftf" font="Verdana" color="0xFF00FF" bold="true" underline="true"/>
<esri:TextSymbol id="ts2" text="Same Verdana" textFormat="{ftf}"/>
<mx:Style>
@font-face {
src:url("assets/esri_1.ttf");
fontFamily: myEmbeddedFont;
unicodeRange:
U+0041-U+005A,
U+0061-U+007A,
U+0030-U+0039,
}
</mx:Style>
<esri:TextSymbol id="ts_esrifont" text="hH Q">
<flash:TextFormat color="0x0000FF" font="myEmbeddedFont" alpha="0.5"/>
</esri:TextSymbol>
var ts4:TextSymbol = new TextSymbol("Some text", null, 0x0000FF);See also
| Property | Defined by | ||
|---|---|---|---|
| alpha : Number
The text alpha (transparency).
| TextSymbol | ||
| angle : Number
The angle of the TextSymbol.
| TextSymbol | ||
| background : Boolean
Specifies whether the text field has a background fill.
| TextSymbol | ||
| backgroundColor : uint
The background color of the text field.
| TextSymbol | ||
| border : Boolean
Specifies whether the text field has a border.
| TextSymbol | ||
| borderColor : uint
The color of the text field border.
| TextSymbol | ||
| color : uint
The text color (if not set with flash:TextFormat).
| TextSymbol | ||
| htmlText : String
Contains the HTML representation of the text field's contents.
| TextSymbol | ||
| placement : String
The text placement.
| TextSymbol | ||
| text : String
The text string to display.
| TextSymbol | ||
| textAttribute : String
The string representing the attribute of the graphic that should populate the "text" content.
| TextSymbol | ||
| textFormat : TextFormat
The text formatting to use for displaying the text.
| TextSymbol | ||
| textFunction : Function
The text function allows for the text of the text symbol to be dynamically picked - for example
based on attributes or position of the graphic.
| TextSymbol | ||
| xoffset : Number
The X offset value in pixels.
| TextSymbol | ||
| yoffset : Number
The Y offset value in pixels.
| TextSymbol | ||
| Method | Defined by | ||
|---|---|---|---|
|
TextSymbol(text:String = null, htmlText:String = null, color:uint = 0x000000, border:Boolean = false, borderColor:uint = 0x000000, background:Boolean = false, backgroundColor:uint = 0xFFFFFF, placement:String = "middle", angle:Number = 0, xoffset:Number = 0, yoffset:Number = 0, textFormat:TextFormat = null, textAttribute:String = null, textFunction:Function = null)
Creates a new TextSymbol.
| TextSymbol | ||
![]() |
clear(sprite:Sprite):void
Clears the graphics that were drawn to the sprite object.
| Symbol | |
![]() |
destroy(sprite:Sprite):void
Removes all the graphics that were drawn to the sprite object and resets its properties.
| Symbol | |
![]() |
Draw the graphics on the sprite object.
| Symbol | |
| Constant | Defined by | ||
|---|---|---|---|
| PLACEMENT_ABOVE : String = "above" [static]
Places the label above the point.
| TextSymbol | ||
| PLACEMENT_BELOW : String = "below" [static]
Places the label below the point.
| TextSymbol | ||
| PLACEMENT_END : String = "end" [static]
Places the label so that the text ends at the point, that is, places the label to the left of the point.
| TextSymbol | ||
| PLACEMENT_MIDDLE : String = "middle" [static]
Places the label centered on the point.
| TextSymbol | ||
| PLACEMENT_START : String = "start" [static]
Places the label so that the text starts at the point, that is, places the label to the right of the point.
| TextSymbol | ||
| alpha | property |
alpha:Number [read-write]The text alpha (transparency). Possible values range from 0.0 (invisible, fully transparent) to 1.0 (opaque, fully visible).
The default value is 1.0 (opaque, fully visible).
This property can be used as the source for data binding.
Implementation public function get alpha():Number
public function set alpha(value:Number):void
| angle | property |
angle:Number [read-write]The angle of the TextSymbol.
The default value is 0.
This property can be used as the source for data binding.
Implementation public function get angle():Number
public function set angle(value:Number):void
| background | property |
background:Boolean [read-write]Specifies whether the text field has a background fill. If true, the text field has a background fill. If false, the text field has no background fill.
The default value is false.
This property can be used as the source for data binding.
Implementation public function get background():Boolean
public function set background(value:Boolean):void
| backgroundColor | property |
backgroundColor:uint [read-write]The background color of the text field. This property can be retrieved or set, even if there currently is no background, but the color is visible only if the text field has the background property set to true.
The default value is 0xFFFFFF (white).
This property can be used as the source for data binding.
Implementation public function get backgroundColor():uint
public function set backgroundColor(value:uint):void
| border | property |
border:Boolean [read-write]Specifies whether the text field has a border. If true, the text field has a border. If false, the text field has no border.
The default value is false.
This property can be used as the source for data binding.
Implementation public function get border():Boolean
public function set border(value:Boolean):void
| borderColor | property |
borderColor:uint [read-write]The color of the text field border. This property can be retrieved or set, even if there currently is no border, but the color is visible only if the text field has the border property set to true.
The default value is 0x000000 (black).
This property can be used as the source for data binding.
Implementation public function get borderColor():uint
public function set borderColor(value:uint):void
| color | property |
color:uint [read-write]The text color (if not set with flash:TextFormat). Setting the color on flash:TextFormat (see sample at top) will overwrite the color set here.
The default value is 0x000000 (black).
This property can be used as the source for data binding.
Implementation public function get color():uint
public function set color(value:uint):void
| htmlText | property |
htmlText:String [read-write]Contains the HTML representation of the text field's contents. When you use the htmlText property, you use a subset of HTML that is supported by Flash Player and AIR, which support the following tags:
This property can be used as the source for data binding.
Implementation public function get htmlText():String
public function set htmlText(value:String):void
See also
| placement | property |
placement:String [read-write]The text placement.
The default value is PLACEMENT_MIDDLE.
This property can be used as the source for data binding.
Implementation public function get placement():String
public function set placement(value:String):void
| text | property |
text:String [read-write]The text string to display.
This property can be used as the source for data binding.
Implementation public function get text():String
public function set text(value:String):void
| textAttribute | property |
textAttribute:String [read-write]The string representing the attribute of the graphic that should populate the "text" content.
This property can be used as the source for data binding.
Implementation public function get textAttribute():String
public function set textAttribute(value:String):void
| textFormat | property |
textFormat:TextFormat [read-write]The text formatting to use for displaying the text.
This property can be used as the source for data binding.
Implementation public function get textFormat():TextFormat
public function set textFormat(value:TextFormat):void
See also
| textFunction | property |
textFunction:Function [read-write]
The text function allows for the text of the text symbol to be dynamically picked - for example
based on attributes or position of the graphic.
This will be used when text symbol does not have its own text property set.
The function should have the following signature:
public function myTextFunction(point : MapPoint, attributes:Object):String
This property can be used as the source for data binding.
Implementation public function get textFunction():Function
public function set textFunction(value:Function):void
| xoffset | property |
xoffset:Number [read-write]The X offset value in pixels.
This property can be used as the source for data binding.
Implementation public function get xoffset():Number
public function set xoffset(value:Number):void
| yoffset | property |
yoffset:Number [read-write]The Y offset value in pixels.
This property can be used as the source for data binding.
Implementation public function get yoffset():Number
public function set yoffset(value:Number):void
| TextSymbol | () | constructor |
public function TextSymbol(text:String = null, htmlText:String = null, color:uint = 0x000000, border:Boolean = false, borderColor:uint = 0x000000, background:Boolean = false, backgroundColor:uint = 0xFFFFFF, placement:String = "middle", angle:Number = 0, xoffset:Number = 0, yoffset:Number = 0, textFormat:TextFormat = null, textAttribute:String = null, textFunction:Function = null)Creates a new TextSymbol. The actual text can be through either 'htmlText', 'text', 'textAttribute' or 'textFunction'. If you set more than one of them, 'htmlText' will take precedence over 'text' which takes precedence over 'textAttribute', which takes precedence over 'textFunction'.
Parameterstext:String (default = null) — The actual text in the TextSymbol.
|
|
htmlText:String (default = null) — Contains the HTML representation of the text field's contents.
|
|
color:uint (default = 0x000000) — The color (in RGB) of the text in the TextSymbol.
|
|
border:Boolean (default = false) — Specifies whether the text symbol has a border.
|
|
borderColor:uint (default = 0x000000) — The border color of the text field in the TextSymbol.
|
|
background:Boolean (default = false) — Specifies whether the text symbol has a background fill.
|
|
backgroundColor:uint (default = 0xFFFFFF) — The background color of the text field in the TextSymbol.
|
|
placement:String (default = "middle") — Specifies the position of the text w.r.t the point.
|
|
angle:Number (default = 0) — The angle (rotation) of the text in the TextSymbol.
|
|
xoffset:Number (default = 0) — The X offset value in pixels.
|
|
yoffset:Number (default = 0) — The Y offset value in pixels.
|
|
textFormat:TextFormat (default = null) — The text formatting to use for displaying the text.
|
|
textAttribute:String (default = null) — The string representing the attribute of the graphic that should populate the "text" content [added in version 1.2].
|
|
textFunction:Function (default = null) — The text function to populate the "text" content [added in version 1.2].
|
| PLACEMENT_ABOVE | constant |
public static const PLACEMENT_ABOVE:String = "above"Places the label above the point.
| PLACEMENT_BELOW | constant |
public static const PLACEMENT_BELOW:String = "below"Places the label below the point.
| PLACEMENT_END | constant |
public static const PLACEMENT_END:String = "end"Places the label so that the text ends at the point, that is, places the label to the left of the point.
| PLACEMENT_MIDDLE | constant |
public static const PLACEMENT_MIDDLE:String = "middle"Places the label centered on the point.
| PLACEMENT_START | constant |
public static const PLACEMENT_START:String = "start"Places the label so that the text starts at the point, that is, places the label to the right of the point.