Actionscript 3 AS3";类型错误:错误“1009”;来自swf内部

Actionscript 3 AS3";类型错误:错误“1009”;来自swf内部,actionscript-3,Actionscript 3,我有一个导入了多个swf的主文件 其中一张幻灯片的输出中显示以下内容: TypeError: Error #1009: Cannot access a property or method of a null object reference. at Loud2_fla::MainTimeline/moveThatMouse() 代码: 另一个是: TypeError: Error #1009: Cannot access a property or method of a null obje

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

其中一张幻灯片的输出中显示以下内容:

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

另一个是:

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


有什么建议吗?

错误告诉您,FLA
Loud2\u-FLA
中的方法
moveThatMouse()
Master\u-FLA
中的方法
playout()
正在尝试访问值为
null
的变量的成员。在你的问题中没有看到这些功能,我只能建议你:

  • 张贴这些功能的内容
  • 查看这些函数并检查其中使用的所有变量。看看哪一个值为空
  • 为了澄清,以下是该错误的发生方式:

    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);
    

    照明
    圆圈
    可能为空。你确定这些对象存在于你函数的上下文中(即在同一帧上)。是的,当我单独播放SWF时,它们工作正常,只有当我导入它们时,它们才会这样做。我觉得动画(圆圈和闪电)和声音与鼠标的X/Y位置有关。。。它不知怎么地把它带到了下一个场景中。:/顺便谢谢你的帮助。这整件事弄得我头晕目眩你能把函数
    playout()
    也贴出来吗?那么如果你
    跟踪(playbutton)
    ,会发生什么呢?对
    照明
    圆圈
    执行相同操作,并查看出现的空值。此外,Master\u fla是主文件,Loud\u fla是导入的swf。。。
    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);
    }
    
    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);