PDA

View Full Version : [AS3] DataGrid problems


MentalBlank
05-16-2010, 06:03 AM
I Have a problem getting the data from my data grid

My XML Loader... This works Fine...i'm using it to load data from an XML File

stop();

Security.allowDomain("*");
//allows it to access stuff^
import fl.controls.DataGrid;
//imports the datagrid component code^
myDG.addColumn("xmldatas");
//adds the header/column named xmldatas to your datagrid
function xmlloader_handler(MouseEvent) {
loadXML(file.text);
}
//the load button code^
function loadXML(url:String) {
var ldr:* = new URLLoader();
var xmlfile:* =new URLRequest(url);
ldr.load(xmlfile);
ldr.addEventListener(Event.COMPLETE, getXMLData);
}
//the load XML function^
function getXMLData(e:Event) {
var purexml:XMLList=new XMLList(e.target.data);
for (var i:int; i<purexml.xmldata.length(); i++) {
myDG.addItem({xmldatas: purexml.xmldata[i]});
addChild(myDG);

}
}
//XML interpreter^
btn.addEventListener(MouseEvent.CLICK, xmlloader_handler);
//button event listener^

Now i want to grab the data from the datagrid, this is where i get stuck:

btn2.addEventListener(MouseEvent.CLICK, sendfileh);
function sendfileh(e:MouseEvent){
if (! sending) {
xmldata=new Array ;

xmldata.push(MyDG.text);

StartSending();

} else {
Sending();
}
}


Any Ideas?