2011-03-25 57 views
0

當我達到第三幀時,出現運行時錯誤。但是,運行時錯誤表示它在frame2:6上。 對於框架3的代碼是:運行時錯誤週期FLASH CS5

stop(); 
buy_cups.addEventListener(MouseEvent.CLICK, buycups); 
function buycups(event:MouseEvent):void{ 
    cash1 = cash1 - 0.25; 
    cups=cups+5; 
} 
buy_ice.addEventListener(MouseEvent.CLICK, buyice); 
function buyice(event:MouseEvent):void{ 
    cash1 = cash1 - 0.25; 
    ice=ice+1; 
} 
buy_lemons.addEventListener(MouseEvent.CLICK, buylemons); 
function buylemons(event:MouseEvent):void{ 
    cash1 = cash1 - 1.25; 
    lemons1=lemons1 + 2; 
} 
buy_straws.addEventListener(MouseEvent.CLICK, buystraws); 
function buystraws(event:MouseEvent):void{ 
    cash1 = cash1 - 0.25; 
    straws=straws+100; 
} 

爲幀2中的代碼是:

stop(); 
//stand.addEventListener(MouseEvent.CLICK, check); 
addEventListener(Event.ENTER_FRAME, check); 
function check(ev : Event) : void { 
    cash.text.text = cash1; 
    storage_count.text.text = storage1; 
    lemons_count.text.text = lemons1; 
    cups_count.text.text = cups; 
    straws_count.text.text = straws; 
    ice_count.text.text = ice; 
} 
shop.addEventListener(MouseEvent.MOUSE_OVER, over_shop); 
function over_shop(event:MouseEvent):void{ 
    shop.gotoAndStop(2); 
} 

shop.addEventListener(MouseEvent.CLICK, shop_now); 
function shop_now(event:MouseEvent):void{ 
    gotoAndStop(3); 
} 

我收到的錯誤是: 警告:未文庫鏈接爲運行時共享庫(RSL):AIR Android [SWF] Lemonade-boy.swf - 解壓縮後的942698字節 TypeError :錯誤#1009:無法訪問空對象引用的屬性或方法。 在Lemonade_fla :: MainTimeline /支票()[Lemonade_fla.MainTimeline ::幀2:6]

如果任何人有什麼可以爲任何的想法,或者是,造成這種請讓我知道。謝謝!

+0

我記得這個遊戲。 – Sam 2011-03-25 04:56:37

回答

0

它正試圖訪問的東西,返回null(又名心不是沒有定義)

它需要加載該幀。 storage1位於何處? (那是第2幀第6行吧?)

+0

但我也在第3幀中定義了它。它仍然給我這個虛假的錯誤。 – 2011-03-25 14:02:44

+0

您需要在第3幀之前定義它。 (您將必須執行此操作將檢查所有這些內容) – jonshariat 2011-03-25 16:24:04