• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Error #2007 - hitTestObject must be non-null

New Here ,
Mar 21, 2008 Mar 21, 2008

Copy link to clipboard

Copied

Ok, so I'm making a game in flash CS3 and I want the character to be able to move to other rooms when they hit something like a door. The way I'm doing it is actionscript goes to another frame when the player movie clip, gpb, hits the door. But it keeps coming up with an error that says "TypeError: Error #2007: Parameter hitTestObject must be non-null." I have no idea what's wrong with it.
Here's the code for what I'm trying to do:

gpb.addEventListener(Event.ENTER_FRAME, collide)

function collide(e:Event){
if(gpb.hitTestObject(door)){
gpb.x=600
gotoAndPlay(3);
}

}
TOPICS
ActionScript

Views

5.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 21, 2008 Mar 21, 2008

Copy link to clipboard

Copied

flash doesn't see a display object with instance name door. door is likely to be an object that existed at one time (or you'd get an 1120 error), but has been gc'd.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 21, 2008 Mar 21, 2008

Copy link to clipboard

Copied

Thanks for the reply. I think I got it working now.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 22, 2008 Mar 22, 2008

Copy link to clipboard

Copied

you're welcome. what was the problem cause?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 22, 2008 Mar 22, 2008

Copy link to clipboard

Copied

I didn't have the door on the next frame and flash couldn't find the door on that frame. So I put in another layer and put the door object on that and that seems to have done the trick.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 22, 2008 Mar 22, 2008

Copy link to clipboard

Copied

LATEST
thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines