arrcol = event.result.venuelist[stateName] as ArrayCollection;


 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of jaguar2800
Sent: Saturday, May 10, 2008 11:22 AM
To: [email protected]
Subject: [flexcoders] Grabbing data dynamically from XML

 

Hey everyone!

got another small issues... this is the last thing i need to fix to
finish my project :-).. what im doing is creating a map that will
allow you to click on a state and using PopUpManager, display data
from that state (the data resides within an xml file).

right now on each click, i run clickState="createPopUp()". the
createPopUp functions runs and initializes the http service to grab
the xml file. in the result handler.. i have it grab the data for the
state. the problem is, i cannot figure out how to make it dynamic so
that when u click on one state it grabs the name and then uses the
name to grab the data from the xml file. for example, right now it
always grabs event.result.venuelist.michigan but i want it to grab
event.result.venuelist.stateName so its dynamic (or something like
that). i think what i need to do is pass a variable with the selected
state through the createpopup function and call it in the
resulthandler.. is that right?? Thank you so much for the help!!!

Here is the result handler that grabs the info from the xml... here i
just set it to grab the data for michigan to make sure it was working..

public function resultHandler(event:ResultEvent):void {
/* var icon:Object = map.target.selected.name; */
arrcol = event.result.venuelist.michigan as ArrayCollection;
dg.dataProvider = arrcol;

Here is the code for creating the popup... i tried to use
this.selectedItem.name to grab the name of the state but it didnt
work. i did it in an alert box to test if it was grabbing the name.

public function createPopUp():void {
var icon:Object = this.selectedItem.name;
var state:String = icon;
Alert.show(state, 'Alert Box', mx.controls.Alert.OK);
getXML.send();
PopUpManager.addPopUp(panel, this, true);
PopUpManager.centerPopUp(panel);

 

Reply via email to