Use for each loop to access the attributes : Loop through : XML Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » XML » Loop through »

 

Use for each loop to access the attributes


 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){


        var loan:XML = <LOAN>
          <BOOK ISBN="0000000000" DUE="111111111111111111">
            <TITLE>ActionScript</TITLE>
            <AUTHOR>J, J</AUTHOR>
            <PUBLISHER>Books Ltd</PUBLISHER>
          </BOOK>
        </LOAN>;
        
        for each (var attribute:XML in loan..@*) {
          trace(attribute.parent(  ).TITLE
                 ": " + attribute.name(  ) "=" + attribute);
        }
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo XML
» Loop through