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