我正在制作一个简单的游戏,我还在学习 as3 我想在舞台上击中测试对象,bila1 和 omidae1 如果 hittestobject gotoframe 所有对象都在舞台上,并且带有 corect instancename,maintimeline as3 下面一切正常,但我明白了空错误
TypeError:错误 #1009:无法访问空对象引用的属性或方法。在 testpeframe_fla::MainTimeline/ bling ()[testpeframe_fla.MainTimeline::frame1:32]
所以问题是Event.ENTER_FRAME,我该如何解决这个问题?
import flash.events.MouseEvent ;
import flash.events.Event;
import fl.transitions.Tween;
import fl.transitions.easing.*;
btnt.visible = false;
butondrr.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler2);
function fl_MouseClickHandler2(event:MouseEvent):void
{
var myTween:Tween = new Tween(bila1, "x", Strong.easeOut, 500, 700, 1, true);
var myTweenm:Tween = new Tween(bila1, "y", Strong.easeOut, 250, 600, 8, true);
}
stage.addEventListener(Event.ENTER_FRAME, bling);
function bling(event:Event):void
{
if(bila1.hitTestObject(omidae1))
{
omidae1.visible = false;
btnt.visible = true;
}
}
removeEventListener(Event.ENTER_FRAME, bling);
stop();
btnt.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame);
function fl_ClickToGoToAndStopAtFrame(event:MouseEvent):void
{
gotoAndStop(5);
}