PDA

View Full Version : Loading XML Data into a DataGrid



krs4kirupa
October 2nd, 2007, 02:59 AM
hi
i am new to AS3. As I was going thru live docs, i was able to load data from an xml file into a DataGrid, I want to know how to make it clickable - on clicking i want a specific data of a column display in a TextArea
Here is my xml
<sites>
<urls link="http://www.adobe.com" category="Design" />
<urls link="http://www.apple.com" category="Cool" />
<urls link="http://www.yahoo.com" category="Mail" />
</sites>
can somebody help me please.
Thanks in advance
krs

absolutezero342
October 2nd, 2007, 12:21 PM
Ok, well you've got your XML data loaded into the DataGrid comp, so your question is how to make the specific data cell "clickable", right?

I have not used the DataGrid component so this is a partial guess, but I'm pretty sure I'm right about this and the Help doc should confirm it. Try this:


import flash.events.Event;

// ...

dataGridInstanceName.addEventListener(Event.CHANGE , handleChange);
// ...

function handleChange(e:Event):void {
messageBoxInstance.text = e.target.selectedItem.label
}

krs4kirupa
October 2nd, 2007, 10:19 PM
hi
I have tried it, it doesn't work. I get error. I have tried

e.target.selectedItem.data; and e.target.selectedItem.label - both give me error.
anyway, i appreciate your help
krs