Hello,
I have the same issue. Howver, I donot get the error frequently, but
on rare occassions.
The way my current code works is,
onMapReadyEvent(){
/*call some function wich in turn calls 3-4 functions and the last
function being
the one which fetches data (latitude and longitude) from database
and tries to instantiate markers.*/
}
As you see above, the markers initialization code is called only when
Map Ready event is fired.
Still, I am getting rare errors which is totally random.
Plz, give me the solution asap.
Regards,
Nayan.
On Mar 29, 11:09 am, akshat joshi <[email protected]> wrote:
> Thanks a ton :-) It is working...as you said it.
>
>
>
> On Sun, Mar 29, 2009 at 7:11 PM, Arothian <[email protected]> wrote:
>
> > 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.- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---