Change value of attribute on an XML object in AS3
17,170
Attributes are accessible in AS3 using the @
prefix.
For example:
var myXML:XML = <test name="something"></test>;
trace(myXML.@name);
myXML.@name = "new";
trace(myXML.@name);
Output:
something
new
Author by
Admin
Updated on June 04, 2022Comments
-
Admin almost 2 years
Is there a easy way to do this? Or do I have to parse the file and do some search/replacing on my own?
The ideal would be something like:
var myXML: XML = ???; // ... load xml data into the XML object myXML.someAttribute = newValue;
-
zproxy over 13 yearsYou can also use the following syntax to access attributes: myXML.attribute("id"), myXML["@id"], and myXML.@["id"]. livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/…