distriqt NativeMaps AS3 API - populating multiple markers example


/ Published in: ActionScript 3
Save to your folder(s)

Just a simple example script for populating a bunch of MapMarker objects on a Map using the distriqt NativeMaps ANE


Copy this code and paste it in your HTML
  1. var markerData:Array = [
  2. { id: -1, name: "myMarker1", title: "marker 1", info: "", location: new LatLng(-37, 144) },
  3. { id: -1, name: "myMarker2", title: "marker 2", info: "", location: new LatLng(-37, 145) },
  4. { id: -1, name: "myMarker3", title: "marker 3", info: "", location: new LatLng(-37, 146) },
  5. { id: -1, name: "myMarker4", title: "marker 4", info: "", location: new LatLng(-37, 147) }
  6. ];
  7.  
  8. for (var i:int = 0; i < markerData.length; i++)
  9. {
  10. var marker:MapMarker = new MapMarker();
  11. marker.name = markerData[i].name;
  12. marker.setPosition( markerData[i].location );
  13. marker.title = markerData[i].title;
  14. marker.info = markerData[i].info;
  15.  
  16. // This stores a reference in our marker data array to the
  17. // ID of the marker which is returned by the addMarker() method
  18. markerData[i].id = NativeMaps.service.addMarker( marker );
  19. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.