Error #2007 Parameter Hittestobject Must Be Non-null
here for a quick overview of the site Help Center Detailed answers to any questions you might have typeerror error #2007 parameter hittestobject must be non-null Meta Discuss the workings and policies of this site About Us typeerror error #2007 parameter text must be non-null 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
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 vote 0 down vote favorite I'm using Flash to create a platform game and i'm just trying to add an http://stackoverflow.com/questions/14810065/error-2007-parameter-hittestobject-must-be-non-null 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 (moveLeft == true) { jon.x -= xspeed; jon.scaleX = -1; } if (moveUp == true && isJumping == false) { isJumping = true; jon.y -= yspeed; } if (moveRight == true) http://stackoverflow.com/questions/28572910/as3-flash-error-2007-parameter-hittestobject-must-be-non-null { 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 looking for? Browse other questions tagged actionscript-3 flash collision-detection or ask your own question. asked 1 year ago viewed 696 times active 1 year ago Related 0TypeError: Error #2007: Parameter hitTestObject must be non-null0TypeError: Error #2007: Parameter text must be non-null error in as30Error #2007: Parameter hitTestObject must be non-null0TypeError: Error #2007: Parameter hitTestObject must be non-null. Why0AS3 TypeError: Error #2007: Parameter hitTestOb
using your existing account on the new forums, check out this thread. Register Help Remember Me? Forum Today's Posts FAQ Calendar https://www.kirupa.com/forum/showthread.php?376099-Error-2007-Parameter-hitTestObject-must-be-non-null Forum Actions Mark Forums Read Quick Links View Forum Leaders What's New? Advanced Search Forum Flash ActionScript 3 [Flash] Error #2007: Parameter hitTestObject must be non-null. Results 1 to http://www.actionscript.org/forums/actionscript-3-0-a/237486-typeerror-error-2007-parameter-hittestobject-null.html 7 of 7 Thread: Error #2007: Parameter hitTestObject must be non-null. Thread Tools Show Printable Version Subscribe to this Thread… Search Thread Advanced Search Display Linear Mode Switch to error #2007 Hybrid Mode Switch to Threaded Mode December 18th, 2012,12:44 PM #1 vinnchow View Profile View Forum Posts 5 posts Registered User Error #2007: Parameter hitTestObject must be non-null. Code: TypeError: Error #2007: Parameter hitTestObject must be non-null. at flash.display::DisplayObject/_hitTest() at flash.display::DisplayObject/hitTestObject() at Assignment/onEnterFrame()[C:\Users\Liang\Desktop\Game assignment\Assignment\Assignment.as:73] This is the error i get. I hope anyone can help me to solve the error #2007 parameter problem. Code: package { import flash.display.MovieClip; import flash.events.KeyboardEvent; import flash.ui.Keyboard; import flash.events.Event; public class Assignment extends MovieClip { var vx:int; var vy:int; var collisionHasOccurred:Boolean; public function Assignment() { init(); } function init():void { //Initialize variable vx=0; vy=0; collisionHasOccurred=false; player.stop(); //Add event listeners stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown); stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp); addEventListener(Event.ENTER_FRAME, onEnterFrame); } function onKeyDown(event:KeyboardEvent):void { if(event.keyCode==Keyboard.LEFT) { vx=-5; } else if (event.keyCode==Keyboard.RIGHT) { vx=5; } else if (event.keyCode==Keyboard.UP) { vy=-5; } else if (event.keyCode==Keyboard.DOWN) { vy=5; } } function onKeyUp(event:KeyboardEvent):void { if (event.keyCode==Keyboard.LEFT || event.keyCode==Keyboard.RIGHT) { vx=0; } else if (event.keyCode==Keyboard.DOWN || event.keyCode==Keyboard.UP) { vy=0; } } function onEnterFrame(event:Event):void { //Move the player player.x+=vx; player.y+=vy; //collision detection if (player.hitTestObject(stone)) { health.meter.width--; if (! collisionHasOccurred) { collisionHasOccurred=true; } } else { collisionHasOccurred=false; } Your help i very appreciated. Last edited by senocular; December 18th, 2012 at 03:01 PM. Reason: Added [code] tags Reply With Quote December 18th, 2012,03:02 PM #2 senocular View Profile View Forum Posts 18,736 posts Semi-present sounds like stone is null. Thats not allowed. Reply With Quote December 19th, 2012,12:36 AM #3 vinnchow View Profile View Forum Po
ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0 TypeError: Error #2007: Parameter hitTestObject must be non-null. User Name Remember Me? Password Register FAQ Community Calendar Today's Posts Search Community Links Social Groups Pictures & Albums Members List Search Forums Show Threads Show Posts Tag Search Advanced Search Go to Page... Thread Tools Rating: Display Modes 04-27-2010, 09:17 AM #1 Mezzer Registered User Join Date: Apr 2010 Posts: 4 TypeError: Error #2007: Parameter hitTestObject must be non-null. I've posted a former thread where i was struggling to get to the next frame. I've now managed to do so but my character wont move when i get to the next frame. this is the code i am using: stop(); avatar_mc.gotoAndStop(1); avatar_mc.venstrefot_mc.gotoAndStop(1); avatar_mc.hoyrefot_mc.gotoAndStop(1); stage.addEventListener(Event.ENTER_FRAME, hitTest); function hitTest(event:Event) { if(avatar_mc.hitTestObject(rect1)){ nextFrame(); } } if (avatar_mc.hitTestObject(parkometer1)) { txt_hit.text = "test"; } { if (avatar_mc.hitTestObject(parkometer2)) txt_hit.text = "Du har truffet parkometeret"; } //Variabler som viser retning: var opp:Boolean = false; var ned:Boolean = false; var venstre:Boolean = false; var hoyre:Boolean = false; // Lengde på forflytning av avatar var fart:Number = 10; // Event-listenere til tastatur: stage.addEventListener(KeyboardEvent.KEY_DOWN, tastNed); stage.addEventListener(KeyboardEvent.KEY_UP, tastOpp); // Event-listener til enter_frame: addEventListener(Event.ENTER_FRAME, nyttBilde); // Event-handler for enter_frame: function nyttBilde(e:Event):void { //Flytt avatar i følge bolske variable: if( venstre ) {txt_banner.text = "Velkommen til Bygghus AS!"
avatar_mc.x -= fart;
avatar_mc.rotationY= 180 ;
} if( hoyre ) { txt_banner.text = "Velkommen til Bygghus AS!" avatar_mc.x += fart; avatar_mc.rotationY = 360; } if( opp ) {txt_banner.text = "Velkommen til Bygghus AS!"
avatar_mc.y -= fart;
avatar_mc.rotation = 0;
} if( ned ) {txt_banner.text = "Velkommen til Bygghus AS!"
avatar_mc.y += fart;
avatar_mc.rotation = 0;
} //Sørg for at avatar ser i rett retning //hvis brukeren holder inn to piltaster: if( ned && venstre) { avatar_mc.rotation = 0; } if( ned && hoyre) { avatar_mc.rotation = 0; } if( opp && venstre) { avatar_mc.rotation = 0; } if( opp && hoyre) { avatar_mc.rotation = 0; } // Sørg for at avatar ikke havner utenfor stage: if( avatar_mc.y < 150 ) { avatar_mc.y = 150; } if( avatar_mc.y > stage.stageHeight ) { avatar_mc.y = stage.stag