尝试setName method:我没有使用它,但是docs表示它也可以用于属性。
var xml:XML = <record id="1" name="CustomerInfo">
<field name="id" index="1" type="String"/>
</record>;
[email protected][0].setName("match");
trace(xml.toXMLString());
[email protected][0].setName("match");
trace(xml.toXMLString());
更新:在Firefox的JavaScript E4X,因此它应该在ActionScript工作了。试试这个:
var xml:XML = <record id="1" name="CustomerInfo">
<field name="id" index="1" type="String"/>
</record>;
var names:XMLList = xml.descendants("@name");//all `name` attributes
for(var i:Number = 0; i < names.length(); i++)
{
names[i].setName("match");
}
trace(xml.toXMLString());
你可以测试'setName'方法并告诉我它是否有效吗?我现在无法访问Flash编译器 – Amarghosh 2010-07-09 10:49:23