我试图引用我的XML对象中的变量
var newElements:XML = new XML();
newElements = <data></data>;
var myNode= "cell0";
newElements.myNode.image = node_image[0];
every works fine:
newElements.cell0.image = node_image[0];
how do i refer the variable myNode as a new node(cell0)?
答案 0 :(得分:0)
请尝试以下语法:
var myNode= "cell0";
newElements[myNode].image = node_image[0];