package{
import flash.display.Sprite;
public class Main extends Sprite{
public function Main(){
var cart:XML =
- crayons
- pencils
- blue pen
- black pen
;
var total:Number = 0;
for each ( var price:XML in cart..@price ) {
total += price;
}
trace( total );
}
}
}