AIR Maps ANE provides the support for using the native mapping component in your Adobe AIR application. It uses Native Extensions to access the maps APIs for that platform and provides an AS3 interface so that it can be used in Flash Mobile applications developed using Adobe AIR.
Currently it supports only iOS native maps. Below is the feature set:
- drawViewPortToBitmapData : It allows you to get the mapview which is displayed on a separate plane above flash stage in form of bitmap data.
- PIN_SELECTED and PIN_DESELECTED Events : Dispatched if a marker is selected or deselected resp.
- MapEvent.DETAIL_BUTTON_PRESSED : Dispatched when details button is pressed for a marker.
- Marker.detailBtn : Ability to show/hide detail button for a marker
- Map.userLocationText(String) : set the user string for user’s location
- Map.zoomToRect(LatLng1, LatLng2) : zooms the map to the rectangle defined by the LatLng provided as its arguments
- Map.openMarker(markerID) : Open the marker callout for the marker with marker id provided as argument. Closes any already open marker.
- Map.closeMarker() : Closes the open marker.
Sample
package com.adobe.nativeExtensions.maps { import flash.external.ExtensionContext; import flash.external.ExternalInterface; import flash.geom.Point; import flash.geom.Rectangle; [Event(name="TILES_LOADED_PENDING" type="com.adobe.nativeExtensions.maps.MapEvent")] [Event(name="TILES_LOADED" type="com.adobe.nativeExtensions.maps.MapEvent")] [Event(name="MAP_LOAD_ERROR" type="com.adobe.nativeExtensions.maps.MapEvent")] public class Map { //Instantiates the map Object public function Map(){ } /********** New Action Script APIs that doesnt exist in Google Maps, but required for adding/removing/modification on stage**************/ //getter for visible property returns true of map is visible else returns false public function get visible():Boolean{ } //setter for visible property, pass true if want to make the map visible on your AIR application, pass false if want to just //hide it for short duration public function set visible(newValue:Boolean):void{ } //gets the area on the stage in which the Map View is displayed public function get viewPort():Rectangle{ } //pass the rectangle where you want your map view to be displayed public function set viewPort(newRect:Rectangle):void{ } //Disposes of the Map object and cleans up other resources public function dispose():void{ } /************ Writing Action Script APIs similar in signature to what Google Maps for Flash offers so that minimal change in code is required for reuse ***********/ //returns the size of the Map View in pixels public function getSize():Point {} //sets the size of the map view to the passed Point(width,height) public function setSize(newSize:Point):void{} //returns the coordinates of the center location in MapView in Latitude/Longitude public function getCenter():LatLng{} //Changes the center location of the map public function setCenter(newCenter:LatLng):void { //Latitude and Longitude should be between (-90,90) and [-180,180] or else Error will be thrown //In fact, Latitude can have a value of -90 and 90 but iOS crashes application on setting the map latitude to -90 or 90 //Please contact me [shahmeet4 at gmail.com] if you find a solution to this } //Retrieves the map zoom level public function getZoom():Number{} //Changes the zoom level for the map view control to the newly provided Zoom Level public function setZoom(newZoomLevel:Number):void{} //Changes the center location of the map to the given location. public function panTo(newCenter:LatLng):void { //Latitude and Longitude should be between (-90,90) and [-180,180] or else Error will be thrown //In fact, Latitude can have a value of -90 and 90 but iOS crashes application on setting the map latitude to -90 or 90 //Please contact me [meetshah at adobe.com] if you find a solution to this } //Displays a pin marker provided as argument onto the map public function addOverlay(marker:Marker):void{} //Removes the pin marker provided as argument from the map public function removeOverlay(marker:Marker):void{} //It sets the Map type to one of the Map Types listed in MapType.as file public function setMapType(int) :void{} //Draws the Map's view port to a bitmap provided in the argument //Since the mapview is displayed on top of the Flash stage just like stagewebview, inorder to display flash components above stage, call this function to get the viewport on a bitmap data. public function drawViewPortToBitmapData(bitmapData:BitmapData):void } }
@as3gamegears: New: AIR Maps ANE (AIR native extension to access iOS maps) http://t.co/eQHgRiJ9 cc @qordas @elecash
RT @as3gamegears: New: AIR Maps ANE (AIR native extension to access iOS maps) http://t.co/cen3jk3E #as3 #flash #gamedev