-1

我有一个导入了多个 swf 的主文件。

其中一张幻灯片在输出中显示:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Loud2_fla::MainTimeline/moveThatMouse()

代码:

function moveThatMouse(evt: MouseEvent):void
{
    circle.x = stage.mouseX;
    lightning.x = stage.mouseX;
    circle.y = stage.mouseY;
    lightning.y = stage.mouseY;
    evt.updateAfterEvent();
}

另一个是:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at Master_fla::MainTimeline/playout()

代码:

playbutton.addEventListener(MouseEvent.MOUSE_OVER, playover)
function playover (event:MouseEvent):void{
    playbutton.inside.gotoAndPlay(2);
}
playbutton.addEventListener(MouseEvent.MOUSE_OUT, playout)
function playout (event:MouseEvent):void{
    playbutton.inside.gotoAndPlay(8);
}

有什么建议么?

4

1 回答 1

1

这些错误告诉moveThatMouse()您 FLA中的方法和其中的Loud2_fla方法正在尝试访问值为. 如果没有在您的问题中看到这些功能,我只能建议您:playout()Master_flanull

  1. 发布这些功能的内容。
  2. 查看这些函数并检查其中使用的所有变量。查看其中哪些持有空值。

为了澄清起见,以下是该错误的发生方式:

function example(shape:Shape):void
{
    shape.x = 10;
}

// Not assigning an instance of Shape to myShape.
// This makes its value null.
var myShape:Shape;

// Error.
example(myShape);
于 2013-03-10T22:20:57.867 回答