-
Collision Detection Error
I'm working on AS3 to make collision detection between two MC. Two instance names are ball and king_stage.
I wrote on frame 1:
stop();
import flash.events.Event;
king_stage.addEventListener(Event.ENTER_FRAME, targetHit);
function targetHit(event:Event):void {
if (king_stage.hitTestObject(ball)) {
gotoAndStop(1, "Scene 2");
}
}
It works but message like this. I don't know why. Please help.
Error message :
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at stop_jump_game_bomb2_fla::MainTimeline/targetHit()
-
Lifetime Friend of Site Staff
One of the objects you're referencing in that code (ball or king_stage) is pretty obviously not initialized when that code first runs. If you want to find out which one, just add checks for null at the beginning of that block of code and don't access those objects until they have been properly initialized.
When your swf2exe tool just HAS to work
there's only one choice... SWF Studio
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|