Finding Elements by Name : XML Object « XML « Flash / Flex / ActionScript






Finding Elements by Name

 

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

        var fruit:XML = <fruit><name>Apple</name></fruit>;
        
        trace( fruit.name );
        
        var author:XML = <author><name><firstName>Darron</firstName></name></author>;
        
        trace( author.name.firstName );

    }
  }
}

        








Related examples in the same category

1.Creating an XML Object
2.Create the XML structure with a string
3.Understanding the XML Classes
4.Using Expressions within Literals: embed ActionScript code directly into your XML data.
5.Adding Attributes to an XML Element
6.Reading Elements in an XML Tree
7.Reading Text Nodes and Their Values