看板 Flash 關於我們 聯絡資訊
想請問一下各位大大 今天做了一個簡單的進度條 但是預視的時候都會跑出 TypeError: Error #1009: 無法存取 Null 物件參考的屬性或方法。 at _fla::MainTimeline/onLoading() 爬過文也google過都解決不了 請問一下是什麼問題 以下是程式碼 stop(); var loadStats:LoaderInfo = this.loaderInfo; this.addEventListener(Event.ENTER_FRAME, onLoading); function onLoading(e:Event):void { var totalByte = loadStats.bytesTotal; var loadByte = loadStats.bytesLoaded; var loadRat = loadByte/totalByte; perCent.text = Math.round(loadRat*100).toString(); bar_mc.scaleX = loadRat; if (loadRat == 1) { this.nextScene(); removeEventListener(Event.ENTER_FRAME, onLoading); } } 謝謝大家... -- 相信自己的相信 堅持自己的堅持 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 219.70.243.45
Reality5566:this.loaderInfo 為 null ? 04/04 23:34
terrylchen:改用ProgressEvent.PROGRESS計算百分比 04/05 14:31
terrylchen:Event.COMPLETE來做判斷loading完成如何? 04/05 14:32
scars:你可以在onLoad裡面每隔一行加個trace 去確認哪一行有null 04/06 10:07