Get and set the xml tag value : Update : XML Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » XML » Update »

 

Get and set the xml tag value


 

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

        var order:XML = <ORDER>
          <ITEM SKU="374">
            <NAME>Toy</NAME>
            <PRICE>39.99</PRICE>
            <QUANTITY>2</QUANTITY>
          </ITEM>
        </ORDER>
        
        var total:Number = 0;
        for each (var item:XML in order.*) {
          traceitem.QUANTITY
                        " " + item.NAME + "(s)."
                        " $" + item.PRICE + " each.n");
          total += item.QUANTITY * item.PRICE;
        
        }
        
        trace("TOTAL: " + total);
        
        for each (var item:XML in order.*) {
          item.PRICE = 1;
        }
        
        trace(order);
        
    }
  }
}

        



Leave a Comment / Note


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


Flash / Flex / ActionScript examples

 Navioo XML
» Update