看板 Flash 關於我們 聯絡資訊
※ 引述《tabear (胖熊)》之銘言: : for(j=1;j<=5;j++){ : imageUrl=data_obj[j].name+".jpg"; : var loadPic:Loader=new Loader(); : loadPic.contentLoaderInfo.addEventListener(Event.COMPLETE : ,function(e:Event):void{ : var icon:Image=new Image(); : icon.source=e.target.content; : addchild(icon); : }); : loadPic.load(new URLRequest(imageUrl)); : } 將你的 loop 寫成 recursion 就行了 function loadImage(j:int){ imageUrl=data_obj[j].name+".jpg"; var loadPic:Loader=new Loader(); loadPic.contentLoaderInfo.addEventListener(Event.COMPLETE ,function(e:Event):void{ var icon:Image=new Image(); icon.source=e.target.content; addchild(icon); if(j<5) loadImage(j+1); }); loadPic.load(new URLRequest(imageUrl)); } loadImage(1); 話說這樣似乎也不太算 recursion -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.243.91.53 ※ 文章網址: http://www.ptt.cc/bbs/Flash/M.1400312661.A.C53.html ※ 編輯: scars (111.243.91.53), 05/17/2014 15:45:35