Hi meydrew -

You cannot create a new Marker (or any other non-Map objects) until
after the MAP_READY event has been fired - so put your marker creation
code inside onMapReady.

- pamela

On Sun, Apr 26, 2009 at 5:52 AM, meydrew <[email protected]> wrote:
>
> ok I didn't want to mess with geocoding at the moment to I'm using a
> FLash-> XML->PHP->mySQL->PHP->XML->Flash solution at the moment where
> the locations are stored on my mySQL server. I'm only mentioning this
> because the 'this_list' is an array holding the XML objects returned
> by the quiery and may be confusing to those reading. my code is as
> follows and I keep getting a: Error #1009: Cannot access a property or
> method of a null object reference. right were I declare my new Marker.
> I was wandering if I was initializing it wrong?
>
> import com.google.maps.LatLng;
> import com.google.maps.Map;
> import com.google.maps.MapEvent;
> import com.google.maps.MapType;
> import com.google.maps.overlays.*;
> import com.google.maps.styles.*;
> import com.google.maps.interfaces.*;
>
> var lat:Number= new Number();
> var lng:Number= new Number();
> var myMarker:Marker;
>
> function setRestInfo(this_list:Array){
>        //trace(this_list);
>        lat=this_list[0].lat;
>        lng=this_list[0].lng;
>        Name=this_list[0].name;
>        Phone="Phone: "+this_list[0].RestPhone;
>        Hours="Opens: "+this_list[0].OpenTime +"\n Closes: "+ this_list
> [0].CloseTime;
>        RestStAddr=this_list[0].RestSA+",\n"+this_list[0].RestCity
> +","+this_list[0].RestState+",\n"+this_list[0].RestZip;
>        myMarker = new Marker(new LatLng(lat,lng));
>        myMarker.setOptions(new MarkerOptions({label: Name}));
>        //myMarker.setLatLng(new LatLng(lat,lng)true));
>                map = new Map();
>                map.key = "my key goes here";
>                map.setSize(new Point(505,310));
>                map.x=270;
>                map.y=215;
>                IMap(map).addOverlay(myMarker);
>                map.addEventListener(MapEvent.MAP_READY, onMapReady);
>                restInfo.addChild(map);
>                search.addChild(restInfo);
>
>                setFields();
>
>        }
>
> function onMapReady(event:Event):void{
>  map.setCenter(new LatLng(lat,lng), 14, MapType.NORMAL_MAP_TYPE);
> }
>
>
> I would really appreciate your input I'm very stuck.
> >
>

--~--~---------~--~----~------------~-------~--~----~
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