Hi cyrt- The problem is that the KMLParser uses the "earth.google.com" namespace instead of the "opengis.net" namespace. If I change your XML to use the old namespace, the parser works. I haven't come up with an elegant system for checking both namespaces.
<kml xmlns="http://earth.google.com/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:atom="http://www.w3.org/2005/Atom"> - pamela On Fri, Mar 6, 2009 at 2:52 AM, cyrt <[email protected]> wrote: > > Hi! > > I'd like to use the KMLParser, but the kml.feature is always null. The > code is exactly the same as in the example, that can be found here > http://gmaps-utility-library-flash.googlecode.com/svn/trunk/examples/KMLParser/bin-release/srcview/index.html > . > > This is my KML file: > > <kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http:// > www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" > xmlns:atom="http://www.w3.org/2005/Atom"> > <GroundOverlay> > <name>ovalay</name> > <Icon> > <href>files/2.jpg</href> > <viewBoundScale>0.75</viewBoundScale> > </Icon> > <LatLonBox> > <north>-13.15204151432014</north> > <south>-13.17376840745433</south> > <east>-72.5013090207886</east> > <west>-72.53105986935958</west> > </LatLonBox> > </GroundOverlay> > </kml> > > And this is the code: > > public function load(fileName:String):void > { > var loader:URLLoader = new URLLoader(); > loader.addEventListener(Event.COMPLETE, loadKML); > loader.load(new URLRequest(fileName)); > > } > > private function loadKML(event:Event):void > { > > var kml:Kml22 = new Kml22(event.target.data); > var rootFeature:Feature = kml.feature; > > kmlObj = new Object(); > > if(kml.feature == null) > { > trace("KML == NULL"); > } > > kmlObj.name = rootFeature.name; > } > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
