AS3编译器不接受对象定义,如下所示:
private var iconList:Object {
1: {
leftUp: 10,
rightBottom: 40,
downScale: 0.5
},
2: {
leftUp: 50,
rightBottom: 80,
downScale: 0.5
},
3: {
leftUp: 90,
rightBottom: 120,
downScale: 0.5
}
}
如何制作多维Object()?
我在AS3中制作一个CSS精灵阅读器,我需要遍历用Loader()加载的图像。为此,我想在Object中设置迭代数据。
答案 0 :(得分:2)
实际上AS3确实支持这一点,你忘记了方程符号。
private var iconList:Object = { // here
1: {
leftUp: 10,
rightBottom: 40,
downScale: 0.5
},
2: {
leftUp: 50,
rightBottom: 80,
downScale: 0.5
},
3: {
leftUp: 90,
rightBottom: 120,
downScale: 0.5
}
}