Package | com.distriqt.extension.nativemaps.objects |
Class | public class CustomMarkerIcon |
Inheritance | CustomMarkerIcon Object |
This class defines a custom image which can be used as the icon for a MapMarker object.
Property | Defined By | ||
---|---|---|---|
centerOffset : Point
centerOffset is the offset in pixels from the center of the marker image
to the position that gets placed at the markers coordinate. | CustomMarkerIcon | ||
id : String
This ID should be used when setting custom icons for map markers. | CustomMarkerIcon | ||
image : BitmapData
The image associated with this custom icon
| CustomMarkerIcon | ||
pixelScale : Number = -1
The pixel scale to be used when drawing this image
For iOS retina displays, this should be set to 2. | CustomMarkerIcon |
Method | Defined By | ||
---|---|---|---|
CustomMarkerIcon(id:String, image:BitmapData = null, pixelScale:Number = -1, centerOffset:Point = null)
Constructor
| CustomMarkerIcon | ||
dispose():void
Disposes any current image bitmap data stored. | CustomMarkerIcon | ||
setCenterOffset(x:Number, y:Number):CustomMarkerIcon
Sets the offsets to use for this marker icon
| CustomMarkerIcon | ||
setImage(image:BitmapData):CustomMarkerIcon
Sets the image used as the marker icon from the given BitmapData instance. | CustomMarkerIcon | ||
setPixelScale(pixelScale:Number):CustomMarkerIcon
Sets the pixel scale for this marker icon. | CustomMarkerIcon |
centerOffset | property |
public var centerOffset:Point
centerOffset
is the offset in pixels from the center of the marker image
to the position that gets placed at the markers coordinate.
Positive offset values move the icon down and to the right, while negative
values move it up and to the left.
By default, the center of the marker icon is placed over the coordinate of the marker. i.e. offsets of 0.
To use the bottom middle of the image as the anchor point you would set the
x offset to be 0
and the y offset to be - imageHeight / 2
var markerImage:Bitmap = ...; var markerIcon:CustomMarkerIcon = new CustomMarkerIcon( "MARKER_ID_1" ) .setImage( markerImage.bitmapData ) .setCenterOffset( 0, -markerImage.height 0.5 );
id | property |
public var id:String
This ID should be used when setting custom icons for map markers.
Set customIconId
property of a MapMarker
instance to match this ID value.
image | property |
public var image:BitmapData
The image associated with this custom icon
pixelScale | property |
public var pixelScale:Number = -1
The pixel scale to be used when drawing this image
For iOS retina displays, this should be set to 2. You should create two versions of marker icons to allow retina display support, and use NativeMaps.service.isRetinaDisplay() to decide which icon to use when creating markers.
The default of -1
will use the device scale and automatically scale
the icon to the device.
CustomMarkerIcon | () | Constructor |
public function CustomMarkerIcon(id:String, image:BitmapData = null, pixelScale:Number = -1, centerOffset:Point = null)
Constructor
Parametersid:String — String A string ID to identify the icon. This must be unique.
| |
image:BitmapData (default = null ) — BitmapData A bitmap data object to be used as the icon.
| |
pixelScale:Number (default = -1 )
| |
centerOffset:Point (default = null )
|
dispose | () | method |
public function dispose():void
Disposes any current image bitmap data stored. This method is used internally. You will probably not need this.
setCenterOffset | () | method |
public function setCenterOffset(x:Number, y:Number):CustomMarkerIcon
Sets the offsets to use for this marker icon
Parameters
x:Number | |
y:Number |
CustomMarkerIcon — CustomMarkerIcon instance for chaining
|
setImage | () | method |
public function setImage(image:BitmapData):CustomMarkerIcon
Sets the image used as the marker icon from the given BitmapData
instance.
Parameters
image:BitmapData — BitmapData instance
|
CustomMarkerIcon — CustomMarkerIcon instance for chaining
|
setPixelScale | () | method |
public function setPixelScale(pixelScale:Number):CustomMarkerIcon
Sets the pixel scale for this marker icon.
Parameters
pixelScale:Number — The pixel scale.
|
CustomMarkerIcon — CustomMarkerIcon instance for chaining
|