Use the length( ) method to count the number of elements found : Double dot : XML Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » XML » Double dot »

 

Use the length( ) method to count the number of elements found


 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){
    //    To examine every element node with a particular node name, use a for each loop
        var items:XML = <items>
                          <item>
                            <name>Apple</name>
                            <color>red</color>
                          </item>
                          <item>
                            <name>Orange</name>
                            <color>orange</color>
                          </item>
                        </items>;
        
        for each var name:XML in items..name ) {
          tracename );    
        }
    }
  }
}

        



Leave a Comment / Note


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


Flash / Flex / ActionScript examples

 Navioo XML
» Double dot