Flex 3 assigning any name to XML node attribute dynamically


While I was in a process to create an xml for swfmill which uses “import” keyword as an attribute like

//i have a node named font
font id ="Strip" import ="f:/santu/STRIP.ttf"

Now,I had to create an application which writes xml in such a format.So for that I need to give attribute name at runtime using like this

var newXml:XML = new XML() ;
newXml.@id ="Hello";
newXml.@import ="F:/...";

And while writing import keyword,the flex compiler throws error as “import ” keyword is used to import packages and classes
So after searching through this article

http://www.insideria.com/2009/01/flex-xml-quick-tip.html

I found how to add import keyword to the XML node .You can do this

newXml.@["import"] ="F:/santu/"

I hope this post can help you all to assign any name to XML node attribute dynamically

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s