Hi guys I have chosen to try the Data Grid component instead of just the list component, everything works out great. Customised the look & everything but no data shown
Can someone help me please.
var mp3_Artist: Array = new Array();
var mp3_Album: Array = new Array();
var mp3_Title: Array = new Array();
var mp3_Time: Array = new Array();
var mp3_Size: Array = new Array();
var mp3_Bitrate: Array = new Array();
var mp3_Genre: Array = new Array();
var mp3_Year: Array = new Array();
var mp3_Comment: Array = new Array();
/******** ! V A R I A B L E S ! **************************/
var xmlData:XML;
var tracksInDirectory:Number;
var xmlLoader:URLLoader = new URLLoader();
var dp:DataProvider;
var A:DataGridColumn = new DataGridColumn("Artist");
A.headerText = "Artist";
A.width = 170;
A.resizable = false;
var B:DataGridColumn = new DataGridColumn("Title");
B.headerText = "Title";
B.width = 170;
B.resizable = false;
var C:DataGridColumn = new DataGridColumn("Album");
C.headerText = "Album";
C.width = 120;
C.resizable = false;
var D:DataGridColumn = new DataGridColumn("Duration");
D.headerText = "Duration";
D.width = 70;
D.resizable = false;
var E:DataGridColumn = new DataGridColumn("Art");
E.headerText = "Art";
E.width = 45;
E.resizable = false;
var myDataGrid:DataGrid = new DataGrid();
myDataGrid.addColumn(A);
myDataGrid.addColumn(B);
myDataGrid.addColumn(C);
myDataGrid.addColumn(D);
myDataGrid.addColumn(E);
myDataGrid.verticalScrollPolicy = ScrollPolicy.ON;
myDataGrid.setSize(575, 250);
myDataGrid.move(25,138);
addChild(myDataGrid);
init();
/******** ! F U N C T I O N S ! **************************/
function init():void
{
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest("mp3_XML.xml"));
}
/*********************************************************/
function LoadXML(e:Event):void
{
xmlData = new XML(e.target.data);
var songArtist:XMLList = xmlData..artist;
var songAlbum:XMLList = xmlData..album;
var songTitle:XMLList = xmlData..title;
var songTime:XMLList = xmlData..time;
var songSize:XMLList = xmlData..size;
var songBitrate:XMLList = xmlData..bitrate;
var songGenre:XMLList = xmlData..genre;
var songYear:XMLList = xmlData..year;
var songComment:XMLList = xmlData..comment;
var len: int = xmlData.song.length();
var i: int = 0;
for (i; i < len; i++) {
var ix = i + 1;
mp3_Artist.push(songArtist[i]);
mp3_Album.push(songAlbum[i]);
mp3_Title.push(songTitle[i]);
mp3_Time.push(songTime[i]);
mp3_Size.push(songSize[i]);
mp3_Bitrate.push(songBitrate[i]);
mp3_Genre.push(songGenre[i]);
mp3_Year.push(songYear[i]);
mp3_Comment.push(songComment[i]);
trace(mp3_Artist[i]);
popList(i);
}
tracksInDirectory = ix;
}
/*********************************************************/
function popList(place:Number):void
{
myDataGrid.dataProvider = new DataProvider(xmlData);
}
just want
mp3_Artist in column A
mp3_Album in column B
mp3_Title in column C
mp3_Time in column D
Thanks
Steven