环境:Flex 3.6
看这段代码:
var arr:Array = new Array()
var t:Object = {number:"12345", id:"Public"};
arr[t] = "Hello";
for (var z:Object in arr)
{
if (z is String)
trace("STRING");
if (z is Object)
trace("OBJECT");
trace("z.number = " + z.number);
}
输出:
STRING
OBJECT
trace()
然后在最后一次调用时崩溃并出现错误:
ReferenceError: Error #1069: Property number not found on String and there is no default value
对象不应该保留字段的名称吗?我做错了什么?