Packagecom.afcomponents.umap.styles
Classpublic class IconStyle
InheritanceIconStyle Inheritance Style

Specifies advanced appearence style for an icon. This style is used by a MarkerStyle object.


Example
Here is a quick example:
 // You should have a custom icon in your library with linked class name "myMarker"
 // (simply draw something, create new symbol, name it & export for AS)
 // Example uses IconStyle object for advanced icon styling
   
 import com.afcomponents.umap.core.UMap;
 import com.afcomponents.umap.styles.MarkerStyle;
 import com.afcomponents.umap.overlays.Marker;
 import com.afcomponents.umap.types.LatLng;
 import com.afcomponents.umap.types.Align;
 import com.afcomponents.umap.events.OverlayEvent;
     
 // create UMap instance
 var map:UMap = new UMap();
 map.setSize(300,300);
 addChild(map);
   
 // create new Marker style
 var style:MarkerStyle = new MarkerStyle();
 style.icon = "myMarker";
 // align icon to bottom center
 style.iconStyle.align = Align.fromString("bottom-center");
 // inflate icon twice it's size
 style.iconStyle.scale = 2;
 // rotate icon 45 degress
 style.iconStyle.rotation = 45;
 // make icon semi-transparent
 style.iconStyle.colorTransform = new ColorTransform(1.0, 1.0, 1.0, 0.5);
  
 // create parameter object
 var param:Object = new Object();
 param.position = new LatLng(20, 10);
 param.autoInfo = false;
 
 // create new marker and add it to the map
 map.addOverlay(new Marker(param, style));

See also

com.afcomponents.umap.styles.MarkerStyle


Public Properties
 PropertyDefined by
  align : Align
Specifies Align object that will be used to align the icon.
IconStyle
  colorTransform : ColorTransform = null
Specifies the color transform object that should be applied to the icon.
IconStyle
  offset : Offset
Specifies new offset distance taht should be applied to icon after aligning.
IconStyle
  rotation : Number = 0
Specifies the rotation angle of the icon in degrees.
IconStyle
  scale : Number = 1
Specifies the scaling factor of the icon.
IconStyle
Public Methods
 MethodDefined by
  
IconStyle(param:Object = null)
IconStyle contructor.
IconStyle
  
applyTo(icon:DisplayObject, target:*):void
Applies the style to a DisplayObject.
IconStyle
 Inherited
Creates a copy of the Style object.
Style
 Inherited
concat(param:Object):Style
Creates a clone of this Style, copies the properties from specified object and returns the new style.
Style
 Inherited
copy(object:Object):void
Copies all the properties from the specified object into the Style object.
Style
 Inherited
copyStyle(dest:Object, src:Object):void
[static] Copies all properties of one object into another.
Style
  
fromXML(xml:XML):IconStyle
[static] Creates new IconStyle from XML object in KML 2.1 format.
IconStyle
 Inherited
[static] Returns new Style object, from the source XML object.
Style
 Inherited
getXMLFromStyle(style:Style, name:String = ""):XML
[static] Returns an XML object that represents all the style's properties.
Style
 Inherited
toString():String
Returns a String that represents all the style's properties.
Style
  
toXML(afcTags:Boolean = false):XML
Builds an XML object in KML 2.1 format that describes the IconStyle.
IconStyle
Property detail
alignproperty
public var align:Align

Specifies Align object that will be used to align the icon.

The default value is bottom-center alignment.

See also

colorTransformproperty 
public var colorTransform:ColorTransform = null

Specifies the color transform object that should be applied to the icon.

The default value is No color transformation..

offsetproperty 
public var offset:Offset

Specifies new offset distance taht should be applied to icon after aligning.

The default value is no offset.

See also

rotationproperty 
public var rotation:Number = 0

Specifies the rotation angle of the icon in degrees.

The default value is 0.

scaleproperty 
public var scale:Number = 1

Specifies the scaling factor of the icon.

The default value is 1.

Constructor detail
IconStyle()constructor
public function IconStyle(param:Object = null)

IconStyle contructor.

Creates new IconStyle object with the default parameters. Properties defined in param object will override the default values.

By default, icon will be aligned bottom-center with no scaling, rotation and color transformation applied.

Parameters
param:Object (default = null) — Object that holds all the properites of a style you wish to override upon its creation.
Method detail
applyTo()method
public function applyTo(icon:DisplayObject, target:*):void

Applies the style to a DisplayObject.

Parameters
icon:DisplayObject — DisplayObject that needs to be aligned.
 
target:* — Target object that we wish to align the icon with. Can be one of the following: DisplayObject, Bounds object or a Point.

See also

fromXML()method 
public static function fromXML(xml:XML):IconStyle

Creates new IconStyle from XML object in KML 2.1 format.

Parameters
xml:XML — XML object with root <IconStyle> node.

Returns
IconStyle — New IconStyle object.

Example
Here is a sample KML structure:
  <IconStyle id="ID">
    <!-- inherited from ColorStyle -->
    <color>ffffffff</color>         <!-- kml:color -->
    <colorMode>normal</colorMode>   <!-- kml:colorModeEnum:normal or random -->
        
    <!-- specific to IconStyle -->
    <scale>1</scale>                <!-- float -->
    <heading>0</heading>            <!-- float -->
  
    <hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>  <!-- kml:vec2Type -->
  </IconStyle>

toXML()method 
public override function toXML(afcTags:Boolean = false):XML

Builds an XML object in KML 2.1 format that describes the IconStyle.

Parameters
afcTags:Boolean (default = false) — Flag that determines whether to generate KML data with extended AFC tags.

Returns
XML — XML object in KML 2.1 format.

Example
Here is a sample KML structure:
  <IconStyle id="ID">
    <!-- specific to IconStyle -->
    <scale>1</scale>                <!-- float -->
    <heading>0</heading>            <!-- float -->
  
    <hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>  <!-- kml:vec2Type -->
  </IconStyle>