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.*) {
trace( item.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);
}
}
}
|