2008/03/24

Object 迭代


public static const CODE_MAP:Object = {

A: "上衣",
B: "針織衫",
C: "褲子",

D: "外套毛衣",
E: "裙子",
F: "洋裝",

G: "針織衫",
H: "帽鞋",
I: "配件包包",

J: "貼身衣物",
K: "其他"
}





for 迭代的結果是取出 key
for each 迭代的結果則是取出 value


for (var key:String in CODE_MAP) {

trace("key : " + key);
}

for each (var value:String in CODE_MAP) {

trace("value : " + value);
}


1 pushs:

Unknown 提到...

原來這可以這樣用 有學到...