Using Expressions within Literals: embed ActionScript code directly into your XML data.
package{
import flash.display.Sprite;
public class Main extends Sprite{
public function Main(){
var squareLength:Number = 10;
var circleRadius:Number = 5;
var shapeData:XML = <shapeList>
<shape type="square" size={squareLength} />
<shape type="cicle" size={circleRadius} />
</shapeList>;
trace(shapeData.toXMLString());
}
}
}
Related examples in the same category