DataGrid data to XML AS3

Probably not the prettiest method to do this, but it’ll do for just before I go home. This is to change datagrid objects back into XML – this is only for my case and needs custom coding, but the method is there!

var newXML:XML = new XML(<coaches></coaches>);

for (var i:int = 0; i < dataGrid.length; i++) 
{
var dataGridObject:Object = dataGrid.getItemAt(i);
var coachXML:XML = new XML(<coach></coach>);
coachXML.name = dataGridObject.name;
newXML.prependChild(coachXML);
}
trace("newXML:" + newXML);
Tech Reference: ,

Leave a Reply

Your email address will not be published. Required fields are marked *

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑