Yes, Arothian, you are right.

I did not realize that Marker constructor's second parameter is optional,
since i also set it something.

I just did a quick experiment. Rock's error, to be more specific, is not
only the Map.addOverlay not in onMapReady, but also it happen even before
mappreinitialize event, since if you attemp to addOverlay in event handler
for "mapevent_mappreinitialize", the error message looks below.


Error: Object not initialized
 at com.google.maps.wrappers::Wrapper$/checkValid()
 at com.google.maps.wrappers::IMapWrapper/addOverlay()


Juguang



On Thu, Jun 25, 2009 at 11:32 PM, Arothian <kevin.form...@gmail.com> wrote:

>
> Hello,
>
> The second option in the Marker constructor isn't required. Usually
> the null error occurs because you are attempting to add a marker
> before the map has been initialized. Most API functions will throw a
> null error until the map is ready. Try adding the markers inside your
> onMapReady function.
>
> Good luck
>
> -Arothian
>
> On Jun 24, 12:33 pm, Juguang XIAO <jugu...@gmail.com> wrote:
> > It seems quite obvious that you miss the second parameter as
> MarkerOptions.
> > Check out the link.
> >
> > http://code.google.com/apis/maps/documentation/flash/overlays.html
> >
> > Juguang
> >
> >
> >
>  > On Wed, Jun 24, 2009 at 10:47 PM, rock <rockla...@googlemail.com>
> wrote:
> >
> > > hi I am trying to develop a navigational system with googles api for
> > > flash and am at the point of adding some markers. I'm quite new to
> > > action script and don't know exactly how to resolve this error
> >
> > > TypeError: Error #1009: Cannot access a property or method of a null
> > > object reference.
> > >        at com.google.maps.overlays::Marker()
> >
> > > the map code I am working with at the moment is
> >
> > > //--Google Map --//
> >
> > > import com.google.maps.Map;
> > >    import com.google.maps.LatLng;
> > >    import com.google.maps.MapEvent;
> > >    import com.google.maps.MapType;
> > >    import com.google.maps.controls.MapTypeControl;
> > >    import com.google.maps.controls.ZoomControl;
> > >    import com.google.maps.controls.PositionControl;
> > >        import com.google.maps.overlays.MarkerOptions;
> > >    import com.google.maps.overlays.Marker;
> >
> > > var map:Map = new Map();
> > > map.key =
> >
> > >
> "ABQIAAAA4mtg0_yOAQswdZC6f0NGKxS1jE4jbpVLla8ckf7FZdRsusTb7hRHWx299NvLgk13X0-
> > > T0Vk9xZW7vg";
> >
> > > map.addEventListener(MapEvent.MAP_READY, onMapReady);
> > > this.addChild(map);
> >
> > > //--Map Size  / x-y position --//
> > > map.setSize(new Point(435, 435));
> > > map.x = 340;
> > > map.y = 125;
> >
> > > //--Map loading Position and Map Type options --//
> > > function onMapReady(event:Event):void {
> > >  map.setCenter(new LatLng(51.54676205809519,-0.011587142944335938),
> > > 14, MapType.NORMAL_MAP_TYPE); map.removeMapType
> > > (MapType.HYBRID_MAP_TYPE); map.removeMapType
> > > (MapType.SATELLITE_MAP_TYPE);
> >
> > >  //--Declaring map controls--\\
> > >        map.addControl(new ZoomControl());
> > >        map.addControl(new PositionControl());
> > >        map.addControl(new MapTypeControl());
> > >    }
> >
> > >          //--Map Markers--\\
> >
> > >    var marker:Marker = new Marker
> > >    (new LatLng
> > > (51.54676205809519,-0.011587142944335938));
> > >    map.addOverlay(marker);
> >
> > --
> > =============
> > Juguang XIAO
> > Beijing, China
> > (+86) 13810607806
>  >
>


-- 
=============
Juguang XIAO
Beijing, China
(+86) 13810607806

--~--~---------~--~----~------------~-------~--~----~
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 google-maps-api-for-flash@googlegroups.com
To unsubscribe from this group, send email to 
google-maps-api-for-flash+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-maps-api-for-flash?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to