probably simple fix
My game is a simple drag helicopter_mc to the landing pad and go to next frame. Simple enough but for some reason everytime i reach the pad the #1009 error comes up . please help , I feel like i have to add something to the next frame, but I dont know. Tried researching but I dont even know whats right to look at .
Heres the error :
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at FinalProjectGame_fla::MainTimeline/handleCollision()
and heres my code
import flash.events.MouseEvent;
import fl.motion.MotionEvent;
stop();
helicopter_mc.addEventListener(MouseEvent.MOUSE_UP, drop);
helicopter_mc.addEventListener(MouseEvent.MOUSE_DOWN, drag);
helicopter_mc.addEventListener(Event.ENTER_FRAME, handleCollision);
//stage.removeEventListener(Event.ENTER_FRAME,collission)
function drag(event:MouseEvent):void
{
event.target.startDrag();
}
function drop(event:MouseEvent):void
{
event.target.stopDrag();
}
function handleCollision(event:Event):void{
if (helicopter_mc.hitTestObject(cloud1))
{
helicopter_mc.nextFrame();
}
if (helicopter_mc.hitTestObject(cloud2))
{
helicopter_mc.nextFrame();
}
if (helicopter_mc.hitTestObject(cloud3))
{
helicopter_mc.nextFrame();
}
if (helicopter_mc.hitTestObject(cloud4))
{
helicopter_mc.nextFrame();
}
if (helicopter_mc.hitTestObject(cloud5))
{
helicopter_mc.nextFrame();
}
if (helicopter_mc.hitTestObject(cloud6))
{
helicopter_mc.nextFrame();
}
if (helicopter_mc.hitTestObject(cloud7))
{
helicopter_mc.nextFrame();
}
if (helicopter_mc.hitTestObject(cloud8))
{
helicopter_mc.nextFrame();
}
if (helicopter_mc.hitTestObject(cloud9))
{
helicopter_mc.nextFrame();
}
if (helicopter_mc.hitTestObject(cloud10))
{
helicopter_mc.nextFrame();
}
if (helicopter_mc.hitTestObject(cloud11))
{
helicopter_mc.nextFrame();
}
if (helicopter_mc.hitTestObject(cloud12))
{
helicopter_mc.nextFrame();
}
if (helicopter_mc.hitTestObject(cloud13))
{
helicopter_mc.nextFrame();
}
if (helicopter_mc.hitTestObject(cloud14))
{
helicopter_mc.nextFrame();
}
if (helicopter_mc.hitTestObject(cloud15))
{
helicopter_mc.nextFrame();
}
if (helicopter_mc.hitTestObject(missle1))
{
helicopter_mc.nextFrame();
}
if (helicopter_mc.hitTestObject(missle2))
{
helicopter_mc.nextFrame();
}
if (helicopter_mc.hitTestObject(heli1))
{
helicopter_mc.nextFrame();
}
if (helicopter_mc.hitTestObject(heli2))
{
helicopter_mc.nextFrame();
}
if (helicopter_mc.hitTestObject(heli3))
{
helicopter_mc.nextFrame();
}
if (helicopter_mc.hitTestObject(pad))
{
nextFrame();
}
}
