I'm having an issue grabbing xml node attributes through a multidimensional loop.



Here is the Actionscript:



Code:
-------------------------------------------------*/

var FourPlayerXML:String = "videoPlayer.xml";

var FourPlayerData:Array = new Array();

var FourPlayerAtts:Array = new Array("id", "title", "description", "lowURL", "highURL", "hdURL", "ipodURL", "thumbURL");

var vidNum:Number;

var attNum:Number = FourPlayerAtts.length;

/* Grab XML and dump it into sorting fuction

-------------------------------------------------*/

var vidXML:XML = new XML();

vidXML.ignoreWhite = true;

vidXML.onLoad = function(success) {

 if (success) {

  dumpData(vidXML);

 }

};

vidXML.load(FourPlayerXML);

/* Sort XML and dump it into the FourPlayerData array

-------------------------------------------------*/

function dumpData(xml) {

 var xmlChild = xml.firstChild.childNodes;

 vidNum = xmlChild.length;

 var i:Number;

 var j:Number;

 for (i=0; i<vidNum; i++) {

  FourPlayerData[i] = new Array();

  for (j=0; j<attNum; j++) {

   var d = FourPlayerAtts[j];

   var e = xmlChild[i].attributes.FourPlayerAtts[j];

   FourPlayerData[i][j] = e;

   trace(e);

  }

 }

}


And here's my xml:



Code:
<videos>

 <video id="0" title="title0" description="description0" lowURL="lowURL0" highURL="highURL0" hdURL="hdURL0" ipodURL="ipodURL0" thumbURL="thumbURL0"></video>

 <video id="1" title="title1" description="description1" lowURL="lowURL1" highURL="highURL1" hdURL="hdURL1" ipodURL="ipodURL1" thumbURL="thumbURL1"></video>

</videos>


The line in question is



Code:
var e = xmlChild[i].attributes.FourPlayerAtts[j];


Rather than xmlChild[i].attributes.id, I'm trying to insert attribute names through an array. It keeps returning 'undefined'.



Is this the best way to accomplish this? Is there a better way to make this work?



Thanks!