Use bracket notation, coupled with an integer, to access a particular element node : Bracket syntax : XML Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » XML » Bracket syntax »

 

Use bracket notation, coupled with an integer, to access a particular element node


 


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

        var items:XML = <items>
                          <item>
                            <name>Apple</name>
                            <color>red</color>
                          </item>
                          <item>
                            <name>Orange</name>
                            <color>orange</color>
                          </item>
                        </items>;
                        
        
        traceitems.item[0].name );
        
        traceitems.item[1].name );
    }
  }
}

        



Leave a Comment / Note


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


Flash / Flex / ActionScript examples

 Navioo XML
» Bracket syntax