FLASH CS5 运行时错误
当我到达第三帧时,出现运行时错误。但是,运行时错误表明它位于第 2 帧:6。 第 3 帧的代码是:
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);
}
我收到的错误是: 警告:由于您的发布设置:AIR Android,没有库被链接为运行时共享库 (RSL) [SWF] Lemonade-boy.swf - 解压后为 942698 字节 TypeError:错误#1009:无法访问空对象引用的属性或方法。 在 Lemonade_fla::MainTimeline/check()[Lemonade_fla.MainTimeline::frame2:6]
如果任何人知道可能或正在导致此问题的原因,请告诉我。谢谢!
I'm getting a runtime error when I reach frame three. however, the runtime error says it's on frame2:6.
The code for frame 3 is:
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;
}
The code for frame 2 is:
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);
}
The error I receive is:
Warning: No libraries were linked as Runtime Shared Libraries (RSLs) because of your publish settings: AIR Android
[SWF] Lemonade-boy.swf - 942698 bytes after decompression
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Lemonade_fla::MainTimeline/check()[Lemonade_fla.MainTimeline::frame2:6]
If ANYONE has any idea of what may be, or is, causing this please let me know. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它正在尝试访问返回 null 的内容(也称为尚未定义),
需要为该帧加载它。 storage1 位于哪里? (这是第 2 帧第 6 行,对吗?)
It is trying to access something that returns null (aka isnt defined yet)
It needs to be loaded for that frame. Where is storage1 located? (that is frame 2 line 6 right?)