【发布时间】:2019-03-30 09:31:15
【问题描述】:
在 AS3 中是否可以导出同一变量的多次迭代,如下例所示:
var item:String = "obj";
var child:XML = new XML(<{item}/>);
child.@x = String(object.x);
child.@y = String(object.y);
child.@n = String(object.name);
child.@w = String(object.width);
child.@h = String(object.height);
//...instead of:
child.@s = String(object.sprite);
//...is the below possible:
for (i = 0; i < <length>; ++i) {
child.@s[i] = String(object.get_sprite(i));
}
//...desired <filename>.xml output:
obj.s0 = "sprite_0"
obj.s1 = "sprite_1"
obj.s2 = "sprite_2"
obj.s3 = "sprite_3"
etc..
【问题讨论】:
-
我正在寻找适用于 AS3 和 Haxe 的 (相同书写*) 解决方案。 *忽略child的细微差别。@> =;与 child.set();
标签: actionscript-3 actionscript