Hello!

The reason your getting that null error is because you can't add
markers to the map during the initialization event. You can start
'using' the map once it fires the MapReady event.

Let me know if you need more direction!


On Mar 29, 5:45 am, "[email protected]" <[email protected]> wrote:
> Hi,
>
> I am new to flex but I figured out how to add google map to my flex
> application but I am not able to add a marker to it.
>
> I also get an error ...
> TypeError: Error #1009: Cannot access a property or method of a null
> object reference.
>         at com.google.maps.overlays::Marker()
>         at FarmMap/init()[C:\development\flex\abc\src\FarmMap.mxml:35]
>
> Did I miss something ? Here is my code...init() is called on
> initialize...it is part of my custom component.
>
> private var gMap:Map;
> private var loc:LatLng;
> private var mark:Marker;
>
> private function init():void
> {
> //var loc:LatLng = new LatLng(12.196625095503334, 75.80535292625427);
>
> gMap = new Map();
> gMap.key = "YOUR_API_KEY_HERE";
> gMap.addControl(new MapTypeControl);
> gMap.addControl(new ZoomControl);
> gMap.addEventListener(MapEvent.MAP_READY, mapReadyHandler);
>
> mapContainer.addChild(gMap);
> loc = new LatLng(12.196625095503334, 75.80535292625427);
>
> mark = new Marker(loc);         // ------------------------------This
> is line 35-------------------------------
>
> mark.setLatLng(loc);
> gMap.addOverlay(mark);
>
> }
>
> Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API For Flash" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-maps-api-for-flash?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to