Reputation: 1607
In AS3, I can write the following :
var message:String = "Hello";
var data:XML = <data>{message}</data>;
but how can I reference the variable to format an XML attribute ?
var color:String = "#FFFFFF";
var p:XML = <p><font color="{color}">{message}</font></p>;
Upvotes: 0
Views: 1285
Reputation: 15717
Just remove the double-quote for your attribute and it should work :
var p:XML = <p><font color={color}>{message}</font></p>;
here your live example : http://wonderfl.net/c/xxtT
Upvotes: 2
Reputation: 3157
This is Flex's syntax :) If you wanna do it in plain old actionscript, use Regex. This will help you build up your expression: http://gskinner.com/RegExr/
Upvotes: 0