Search code examples
flashactionscript-3flex3flexbuilderflash-cs3

dynamic xml reading in flash


i want to read an xml file in flash that is returned from a php script. i have it all sorted apart from one thing

the attributes that are returned in each row vary (anything from 1 to 100).

below is the code to explain what i mean

for(var ii:int = 0; ii < tempXML.record.length(); ii++)
{
  for(var b:int = 0; b < numAttributes; b++)
  {
     //what i am aiming for here is the ability to have @"arr"+ a number here
     trace(tempXML.record[ii].@arr+numAttributes);
  }         
}

hopfully you can see what i am getting at. any help apprechiated Cheers Mark


Solution

  • i managed to get it working discovered attributes() and that sorted it so the below worked well for my needs

    for(var ii:int = 0; ii < tempXML.record.length(); ii++)
    {
       for(var b:int = 0; b < numRows; b++)
       {
          trace(tempXML.record[ii].attributes()[b].name());
       }            
    }
    

    Regards Mark