获取TypeError:错误#1009:无法访问空对象引用的属性或方法

时间:2013-06-17 20:52:08

标签: actionscript-3 flash

这是我的ActionScript,我想知道是否有人可以提供帮助?谢谢:)

  

停止();

     

import flash.events.Event; import flash.events.MouseEvent;

     

//告诉舞台停止收听点击   stage.addEventListener(MouseEvent.CLICK,cutCut);

     

//通过删除侦听器告诉cut不再跟随鼠标

cut.removeEventListener(Event.ENTER_FRAME, followMouse);

// return cut to the correct x and y
cut.x = 258.20;
cut.y = 318.50;

dynamite.addEventListener(Event.ENTER_FRAME, followMouse2);

function followMouse2(event:Event):void {
  dynamite.x = mouseX;
  dynamite.y = mouseY;
}

stage.addEventListener(MouseEvent.CLICK, explode);

function explode(event:MouseEvent):void {
  // tell the stage to stop listening for clicks
  stage.removeEventListener(MouseEvent.CLICK, explode);

  // tell the dynamite to stop following the mouse
  dynamite.addEventListener(Event.ENTER_FRAME, followMouse2);

  // tell the timeline to go to the next scene
  nextScene();
}

当我尝试在Flash中调试它时,它会告诉炸药停止跟随包含以下内容的行:

dynamite.addEventListener(Event.ENTER_FRAME, followMouse2); <-- that is causing the problem

我不知道为什么,因为我之前已经为它做了一个功能。谢谢!我非常感激!

0 个答案:

没有答案