Creating a new attribute in an XML node using E4X in AS3

Is there any way to do this?

+4
source share
5 answers

Thanks for answering.

I found your explanations and suggestions of links interesting and encouraging.

In any case, I did not clarify my question. I would like to know how to create any property without even knowing its name. I read several documents and manuals until I understood. Hope this helps.

var data:XML = <node/>; var $my_attr:String = 'id'; data.@ [$my_attr] = 'foo'; 
+10
source

To add an attribute, you need to write how

xmlNode.attributes. @attr = "value";

Hope this works.

thanks Amitd

+1
source

xmlNode.attributes ['attribute'] = 'attribute value';

+1
source

Long answer: read the documentation. It is really very rich. Entire chapters are devoted to XML and E4X. Here is a link that may be useful to you.

Short answer: Yes.

0
source

dirkgently did not directly tell you how to do this, I think, with an educational purpose. However, here's how:

 var xml:XML = <node/>; xml.@attr = "value"; 

TA-dah! But please RTFM.

0
source

All Articles