Error #2007 Parameter Hittestobject
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Error #2007: Parameter hitTestObject must be non-null up vote 0 down vote favorite this is my code- it's working and moving to frame 3 but everything is stuck there and I get this Error #2007 function createMC(event:Event):void { var hasa_mc:MovieClip= new hasa(); stage.addChild(hasa_mc); var halfMc:int=hasa_mc.width/2; hasa_mc.x=randomNum(70+halfMc,480-halfMc); hasa_mc.addEventListener(Event.ENTER_FRAME, abc); hasa_mc.addEventListener(Event.ENTER_FRAME, dropCheckHit); function dropCheckHit(event:Event):void { if (hasa_mc.hitTestObject(hauta1_mc)) { hasa_mc.removeEventListener(Event.ENTER_FRAME, dropCheckHit); event.target.parent.removeChild(event.target); countertime++; score_txt.text=String(countertime*10) if (countertime==10) { gotoAndStop(3); } actionscript-3 flash share|improve this question edited Feb 11 '13 at 10:23 NAZIK 4,446114292 asked Feb 11 '13 at 10:17 user2051003 32 add a comment| 2 Answers 2 active oldest votes up vote 1 down vote accepted The error code and description refers to the line: if (hasa_mc.hitTestObject(hauta1_mc)) { My guess would be the movieclip hauta1_mc does not exist on frame 3 of your movie, so once you go to frame 3 and your dropCheckHit function executes the null reference error is thrown. To resolve you can remove the enter frame listener and stop checking if the movieclip has been hit: if (countertime==10) { hasa_mc.removeEventListener(Event.ENTER_FRAME, dropCheckHit); gotoAndStop(3); } Note: You may need to remove the other listener you have on hasa_mc as well if hasa_mc does not exist in frame 3. share|improve this answer answered Feb 11 '13 at 10:23 Simon McArdle 863519 add a comment| up vote 0 down vote thank you. from where i need to remove also ? still does not works. when it goes to frame 3 there is new MC that hit new object function dropCheckHit(event:Event):void { if (hasa_mc.hitTestObject(hauta1_mc)) { hasa_mc.removeEventList
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up AS3 Flash - Error #2007: Parameter hitTestObject must be non-null up http://stackoverflow.com/questions/14810065/error-2007-parameter-hittestobject-must-be-non-null vote 0 down vote favorite I'm using Flash to create a platform game and i'm just trying to add an if statement with hitTestObject in to trace some words but when i hit platforms but I keep getting the error "Parameter hitTestObject must be non-null". Here's my code: //variables public var jon: Player; public var platforms:Platform; public function gameloop(Event) { //applying gravity jon.y += gravity; //adding movement if http://stackoverflow.com/questions/28572910/as3-flash-error-2007-parameter-hittestobject-must-be-non-null (moveLeft == true) { jon.x -= xspeed; jon.scaleX = -1; } if (moveUp == true && isJumping == false) { isJumping = true; jon.y -= yspeed; } if (moveRight == true) { jon.x += xspeed; jon.scaleX = +1; } //adding collisions for platforms **NOT WORKING** if(jon.hitTestObject(platforms)) { trace("hello i am working"); } } actionscript-3 flash collision-detection share|improve this question asked Feb 17 '15 at 23:05 Callum Singh 446 add a comment| 1 Answer 1 active oldest votes up vote 1 down vote accepted The error indicates that platforms is null. Neither jon or platforms is created in the code you posted, I'm guessing these are timeline symbols? Make sure you have given a symbol the name platforms in your timeline, and make sure it exists on the frame that gameloop is added. share|improve this answer answered Feb 18 '15 at 1:51 Aaron 5,3061524 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're loo
Start here for a quick overview of the site Help Center Detailed answers to any questions you might http://gamedev.stackexchange.com/questions/51467/type-error-for-hit-testing-two-objects-created-with-actionscript have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Game Development Questions Tags Users Badges Unanswered Ask Question _ Game Development Stack Exchange is a question and answer site for professional and independent error #2007 game developers. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Type Error for hit testing two objects created with actionscript up vote 0 down vote favorite I am making a zombie error #2007 parameter shooter game where I get an error when I try to hit test two objects created with actionscript. Could someone post a possible fix please. Here is the Error Code; TypeError: Error #2007: Parameter hitTestObject must be non-null. at flash.display::DisplayObject/_hitTest() at flash.display::DisplayObject/hitTestObject() at game3_fla::MainTimeline/zombiemove() and here is my game code; import flash.events.Event; var zombiehits:Number = 2; var numzombies1:Number = GenerateRandomNumber(10); var zombie : Z = new Z(); var objz; var objb; stop(); //Change mouse crosshair_mc.mouseEnabled = false; crosshair_mc.addEventListener(Event.ENTER_FRAME, fl_CustomMouseCursor); Mouse.hide(); //EventListners; stage.addEventListener(Event.ENTER_FRAME, alwayson); stage.addEventListener(MouseEvent.MOUSE_MOVE,facecursor); stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown); //Code; var startcountdown:Number = 5; var fl_CountDownTimerInstance:Timer = new Timer(1000,startcountdown); fl_CountDownTimerInstance.addEventListener(TimerEvent.TIMER_COMPLETE, startgame); fl_CountDownTimerInstance.start(); function createZombie():void { zombie.rotation = 90; zombie.height = 85.35; zombie.width = 55.9; zombie.x = 403.25; zombie.y = -86.9; addChild(zombie); trace("spawned the zombie"); zombie.addEventListener(Event.ENTER_FRAME,zombiemove); } function zombiemove(event:Event) { var zombie = event.currentTarget; objz = zombie; zombie.y += 1; if (zombie.hitTestObject(objb) == true) { dead -= 1; } if (dead == 0) { removeChild(zombie); zombie.removeEventListener(Event.ENTER_FRAME,zombiemove); } } function alwayson(event:Event) { if (character_mc.hitTestObject(wallleft) == true) { charac