| Package | com.esri.ags.symbols |
| 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.
Default MXML PropertytextFormat
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 | |
![]() | createSwatch(width:Number = 50, height:Number = 50):UIComponent
Creates a swatch for a symbol which can be used in a legend. | 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 | |
![]() |
Initialize the sprite. | 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:NumberThe 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).
public function get alpha():Number public function set alpha(value:Number):void| angle | property |
angle:NumberThe angle of the TextSymbol.
The default value is 0.
public function get angle():Number public function set angle(value:Number):void| background | property |
background:BooleanSpecifies 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.
public function get background():Boolean public function set background(value:Boolean):void| backgroundColor | property |
backgroundColor:uintThe background color of the text field. This property can be retrieved or set, even if there currently is no background, but the color is only visible if the text field has the background property set to true.
The default value is 0xFFFFFF (white).
public function get backgroundColor():uint public function set backgroundColor(value:uint):void| border | property |
border:BooleanSpecifies 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.
public function get border():Boolean public function set border(value:Boolean):void| borderColor | property |
borderColor:uintThe 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).
public function get borderColor():uint public function set borderColor(value:uint):void| color | property |
color:uintThe 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).
public function get color():uint public function set color(value:uint):void| htmlText | property |
htmlText:StringContains 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:
public function get htmlText():String public function set htmlText(value:String):voidSee also
| placement | property |
placement:StringThe text placement.
The default value is PLACEMENT_MIDDLE.
public function get placement():String public function set placement(value:String):void| text | property |
text:StringThe text string to display.
public function get text():String public function set text(value:String):void| textAttribute | property |
textAttribute:StringThe string representing the attribute of the graphic that should populate the "text" content.
public function get textAttribute():String public function set textAttribute(value:String):void| textFormat | property |
textFormat:TextFormatThe text formatting to use for displaying the text.
public function get textFormat():TextFormat public function set textFormat(value:TextFormat):voidSee also
| textFunction | property |
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.
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
public function get textFunction():Function public function set textFunction(value:Function):void| xoffset | property |
xoffset:NumberThe X offset value in pixels.
public function get xoffset():Number public function set xoffset(value:Number):void| yoffset | property |
yoffset:NumberThe Y offset value in pixels.
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 with respect to 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 = abovePlaces the label above the point.
| PLACEMENT_BELOW | Constant |
public static const PLACEMENT_BELOW:String = belowPlaces the label below the point.
| PLACEMENT_END | Constant |
public static const PLACEMENT_END:String = endPlaces 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 = middlePlaces the label centered on the point.
| PLACEMENT_START | Constant |
public static const PLACEMENT_START:String = startPlaces the label so that the text starts at the point, that is, places the label to the right of the point.
<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}"/>
<fx:Style>
@font-face {
src: url("assets/esri_1.ttf");
fontFamily: myEmbeddedFont;
unicodeRange:
U+0041-U+005A, /* Upper-Case [A..Z] */
U+0061-U+007A, /* Lower-Case a-z */
U+0030-U+0039, /* Numbers [0..9] */
U+002E-U+002E; /* Period [.] */
}
</fx: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);