var mc1:MovieClip = new MovieClip(); mc1.name = 'material'; var mc2:MovieClip = new MovieClip(); mc2.name = 'furniture'; var mc3:MovieClip = new MovieClip(); mc3.name = 'instant'; var obj:Object = { material: mc1, furniture:mc2, instant:mc3 }; trace('--------------------------------------'); for (var key:String in obj) { trace(obj[key]); trace(key); } /* [object MovieClip] furniture [object MovieClip] instant [object MovieClip] material */ trace('obj[item]--------------------------------------'); for each(var item:String in obj) { trace(item); } /* [object MovieClip] [object MovieClip] [object MovieClip] */ trace('elementがobjになる--------------------------------------'); for each(var element:Object in obj) { trace(element); } /* [object MovieClip] [object MovieClip] [object MovieClip] */
2013年12月7日土曜日
for each
登録:
コメントの投稿 (Atom)
0 件のコメント:
コメントを投稿