【发布时间】:2014-04-13 23:34:31
【问题描述】:
您好,如果有人可以提供帮助,我正在徘徊,当我尝试在 as3 中启动某些东西时,我不断收到这个错误。我需要导入一些东西吗?抱歉,我最初学习的是 AS2,现在正在慢慢学习 AS3。
婴儿步骤。
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at draganddropframe1_resetter2_0_fla::MainTimeline/frame3()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
this.window_mc.visible = true;
this.windwo_mc.offwindow.addEventListener(MouseEvent.CLICK, shutwin);
function shutwin(event:MouseEvent):void
{
this.window_mc.visible = false;
}
更新-----------
似乎通过将直接路径更改为“this”来解决此问题的方法。在影片剪辑内部单击,添加了一个名为操作的层并插入了此脚本,该脚本引用了我想要在单击时隐藏的影片剪辑。
this.addEventListener(MouseEvent.CLICK, fl_ClickToHide);
function fl_ClickToHide(event:MouseEvent):void
{
this.visible = false;
}
【问题讨论】:
-
很高兴知道您已经解决了问题。在 StackOverflow 中,您可以发布您的解决方案作为您对此问题的答案并接受它。
标签: actionscript-3 flash methods sprite nullreferenceexception