Hi Jonathan,

Yes.   Thank you very much for the response.    The code does remove
the error and loads.. however it also removes the customIcons from the
map..  How would I be able to display the custom Image markers by
type?

Should I try loading them in another manner?

Thanks,

David G.



On Jan 11, 3:51 pm, Jonathan Wagner <[email protected]> wrote:
> Hey David,
>
> I loaded the demo, the problem is coming from the custom icons:
>
>   [Embed(source="../../images/blue-dot.png")] private var
> blueIcon:Class;
>   [Embed(source="../../images/green-dot.png")] private var
> greenIcon:Class;
>
> Since neither of these two images exist, when the code tries to
> instantiate the class, it fails. A constructor is a primary function
> of a class. To fix the bug use this:
>
> public function createMarker(latlng:LatLng, name:String,
> address:String, type:String): Marker {
>         var marker:Marker = new Marker(latlng, new MarkerOptions
> ({iconOffset: new Point(-16, -32)}));
>         var html:String = "<b>" + name + "</b> <br/>" + address;
>         marker.addEventListener(MapMouseEvent.CLICK, function
> (e:MapMouseEvent):void {
>           marker.openInfoWindow(new InfoWindowOptions
> ({contentHTML:html}));
>         });
>         return marker;
>      }
>
> Jonathan
> Scribblemaps.com
>
> On Jan 11, 11:49 am, David Green <[email protected]> wrote:
>
> > Group,
>
> > I was hoping that I'd be able to figure out the answer to why I'm
> > getting errors using the xml parsing demo for google maps for
> > flash.    Jonathan wrote back and referred me to Pamela's KML Demo but
> > I'm not using KML at all..
>
> > I'm wondering if anyone has a fix for the error in the xml parsing
> > demo or is there another approach I should be using?  I can't seem to
> > find the answer anywhere on the net.
>
> > I'm using Flex 3 and mysql/php to parse the xml
>
> > The exact error on the demos are:
>
> > TypeError: Error #1007: Instantiation attempted on a non-constructor.
> >         at XmlParsingDemo/createMarker()
> >         at XmlParsingDemo/readXml()
> >         at flash.events::EventDispatcher/dispatchEventFunction()
> >         at flash.events::EventDispatcher/dispatchEvent()
> >         at flash.net::URLLoader/onComplete()
>
> > Are the demo's on the Google maps site depreciated?  They also throw
> > an error when viewed in the browser.
>
> > I get the error on the tutorial located 
> > herehttp://code.google.com/apis/maps/articles/phpsqlflex.html and an
> > error on the demo located 
> > athttp://gmaps-samples-flash.googlecode.com/svn/trunk/demos/XmlParsingD...
>
> > Thanks for your help..
>
> > David G.
>
> > On Jan 7, 10:02 pm, Jonathan Wagner <[email protected]> wrote:
>
> > > Pamela posted some other stuff for processing KML, try out this:
>
> > > Here's the 
> > > reference:http://gmaps-utility-library-flash.googlecode.com/svn/trunk/docs/com/...
>
> > > Here's the 
> > > demo:http://gmaps-utility-library-flash.googlecode.com/svn/trunk/examples/...
>
> > > Jonathan
> > > Scribblemaps.com
>
> > > On Jan 7, 10:00 pm, David Green <[email protected]> wrote:
>
> > > > I am learning to work with Google Maps using Flex.   I recreated the
> > > > xml parsing demo locally and it kept throwing the error TypeError:
> > > > Error #1007Instantiationattemptedon anon-constructorerror.   At
> > > > first I thought it was something that I was doing wrong so I went back
> > > > to look at the demo again.
>
> > > > I discovered the demo on the site is throwing the same error in the
> > > > both IE and Firefox browsers..  (I'll paste it below).
>
> > > > I have the debug version of flash installed and apparently it is
> > > > catching the error.   Does anyone know what to do to fix the problem?
>
> > > > URL:http://gmaps-samples-flash.googlecode.com/svn/trunk/demos/XmlParsingD...
>
> > > > TypeError: Error #1007:Instantiationattemptedon anon-constructor.
> > > >     at XmlParsingDemo/createMarker()
> > > >     at XmlParsingDemo/readXml()
> > > >     at flash.events::EventDispatcher/dispatchEventFunction()
> > > >     at flash.events::EventDispatcher/dispatchEvent()
> > > >     at flash.net::URLLoader/onComplete()
>
> > > > I think it has something to do with this function
>
> > > > public function createMarker(latlng:LatLng, name:String,
> > > > address:String, type:String): Marker {
> > > >           var marker:Marker = new Marker(latlng, new MarkerOptions
> > > > ({icon: new customIcons[type], iconOffset: new Point(-16, -32)}));
> > > >         var html:String = "<b>" + name + "</b> <br/>" + address;
> > > >         marker.addEventListener(MapMouseEvent.CLICK, function
> > > > (e:MapMouseEvent):void {
> > > >           marker.openInfoWindow(new InfoWindowOptions
> > > > ({contentHTML:html}));
> > > >         });
> > > >         return marker;
> > > >      }
>
> > > > I really want to keep learning but this is stopping me from
> > > > advancing.  Any help would be appreciated.
>
> > > > Thanks,
-- 
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