I've tried something similar and it work fine.
However, the problem seem to occure when I want to import a
xml-file.
I've copied and pasted your code into an xml-file, loaded it
and made sure it worked.
But when I try to load my own xml-file into flash the data
won't display in the grid.
I've made the changes I needed (changed the name of the the
objects, etc. to fit the data I want to display in the grid) but it
just won't work.
Since I've tested your xml-code in an external xml-file I
would assume it would also work with the xml-file I want to load
into the flash.
So, what the heck is wrong??
Here's my code for loading and trying to display the XML in
flash:
import fl.data.DataProvider;
import fl.controls.DataGrid;
import fl.controls.dataGridClasses.DataGridColumn;
var myUrlLoader:URLLoader = new URLLoader();
var myUrlReq:URLRequest = new
URLRequest("exportdisplay_bildatatest.xml");
myUrlLoader.load(myUrlReq);
myUrlLoader.addEventListener(Event.COMPLETE, dataOK);
function dataOK(e:Event):void{
var data:XML = new XML(myUrlLoader.data);
var dp:DataProvider = new DataProvider(data);
var dg:DataGrid = new DataGrid();
dg.setSize(400, 300);
var col:DataGridColumn;
col = dg.addColumn("Ã…rsmodell");
col.dataField ="Arsmodell";
col = dg.addColumn("Merke");
col.dataField ="Merke";
col = dg.addColumn("Modell");
col.dataField ="Modell";
col.sortable=false;
dg.dataProvider = dp;
addChild(dg);
}
PS!
The xml-file I want to display is an xml-file that is
generated each afternoon and uploaded to a server.
Could it be that the problem lies within this proscess??
I've checked the file and it seem OK...
And when I trace it in flash the contents displays in the
Output-box.