Hi Pamela,
I am also having same kind of issue. The problem is that loadXML method is
not getting executed and I am having the error: "Error #2044: Unhandled
ioError:. text=Error #2032: Stream Error."
My code looks like:
private function onMapReady(event:MapEvent):void {
this.map.enableScrollWheelZoom();
this.map.enableContinuousZoom();
this.map.setCenter(myGeographicCoordinates, 4,
MapType.NORMAL_MAP_TYPE);
//Adding map controls
this.map.addControl(new ZoomControl());
this.map.addControl(new PositionControl());
this.map.addControl(new MapTypeControl());
this.map.addControl(new OverviewMapControl());
//load sample file
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, loadXML);
loader.load(new URLRequest("AlertSample.kml"));
var data:Object = event.currentTarget;
}
public function loadXML(event:Event):void {
trace(event.target.data);
var parser:KMLParser = new KMLParser(event.target.data);
}
Can you please help me to figure out the cause?
Thanks,
Amit
On Fri, Mar 6, 2009 at 1:57 PM, pamela fox <[email protected]> wrote:
>
> Hi Javier-
>
> You should put the lines of code that fill the UI into the readXml for loop
> -
>
> for (var i:Number = 0; i < fotosCount; i++) {
> var foto:XML = fotos[i];
> var id_foto:int = fo...@id;
> var name:String = fo...@name;
> image_name=name;
> labelName2.text = String(image_name);
> }
>
> Just make sure to make labelName2 a global variable inside that class.
>
> - pamela
>
> On Wed, Mar 4, 2009 at 11:24 PM, Javier <[email protected]>
> wrote:
> >
> > Hi, I have a problem with loading the content from a XML into a
> > InfoWindowTabbedComponent.
> > I create the marker with a custom InfoWindowTabbedComponent in wich I
> > create some Pane with HBox using the TabNavigator InfoWindow Demo, and
> > I load other information relative to each marker that i get from a
> > sql DB.
> >
> > I have tested the program with a debugger ant it gets the information
> > from the DB, and doesn't show any problem.
> > I have 2 tables in my DB, table "markers" and table "images" with
> > images associated with markers.
> > The structure of the program is:
> >
> > //I pass and id, to search in "images" DB table and get only the
> > images that belongs to the marker wich I'm creating and putting on
> > the map
> >
> >
> > var options:InfoWindowOptions = new InfoWindowOptions({
> > customContent: new InfoWindowTabbedComponent
> > (marker,id),
> > .......
> > }
> >
> >
> > Then the package with the personalized InfoWindowTabbedComponent:
> >
> > public class InfoWindowTabbedComponent extends UIComponent {
> >
> > public var marker:Marker;
> > public var id_marker:int;
> > public var image_name:String;
> >
> > public function InfoWindowTabbedComponent(m:Marker,id_m:int) {
> >
> > marker = m;
> > id_marker=id_m;
> > getData();
> > var panel:Box = new Box();
> > panel.width = 290;
> > panel.height = 100;
> > var hbox:HBox = new HBox();
> > var labelName1:Label = new Label();
> > labelName1.text = String(id_marker);
> > labelName1.width = 70;
> >
> > var labelName2:Label = new Label();
> > labelName2.text = String(image_name); // Image_name never takes
> > a value !!!!
> > labelName2.width = 70;
> >
> > hbox.addChild(labelName1);
> > hbox.addChild(labelName2);
> >
> > panel.addChild(hbox);
> > addChild(panel);
> > }
> >
> >
> > public function getData():void {
> >
> > var urlRequest:URLRequest = new URLRequest
> > ("phpSqlToXml_fotos.php");
> > urlRequest.method = URLRequestMethod.POST
> > var variables:URLVariables = new URLVariables();
> > variables.id_marker = id_marker;
> > urlRequest.data = variables;
> > var urlLoader:URLLoader = new URLLoader(urlRequest);
> > urlLoader.addEventListener("complete",readXml);
> > }
> >
> > public function readXml(event:Event):void{
> >
> > var fotosXML:XML = new XML(event.target.data);
> > var fotos:XMLList = fotosXML.foto;
> > var fotosCount:int = fotos.length();
> >
> > for (var i:Number = 0; i < fotosCount; i++) {
> > var foto:XML = fotos[i];
> > var id_foto:int = fo...@id;
> > var name:String = fo...@name;
> > image_name=name; // IT RETURNS
> > NULL
> > }
> > }
> >
> > ------------------------------------
> >
> > The problem is with the urlLoader.addEventListener
> > ("complete",readXml); because when I create the marker1, it creates
> > the InfoWindowTabbedComponent to the marker1, then it executes getData
> > but it doesn't execute readXml, it waits to the event.complete at the
> > end of the program, then when the InfoWindowTabbedComponent is
> > created, it doesn't have information about the images, because readXml
> > has not been executed yet.
> >
> > How can I do to execute readXml inmediatly beore getData to fill the
> > InfoWindowTabbedComponent with information relative to images?
> >
> > 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
-~----------~----~----~----~------~----~------~--~---