Error #1006 Hittestobject Is Not A Function
here for a quick overview of the site Help Center Detailed answers to any questions you might have as3 hittestobject is not a function Meta Discuss the workings and policies of this site About Us hittestpoint is not a function 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 hitTestObject is not a function up vote -1 down vote favorite hey guys just trying to make simple game in flash where this character runs and collects coins and then the coin count increases. this was working fine when i was dealing with just one coin and then i tried to do it with arrays and this error. is there any other way to do it? i am new to as3 just doing it for 2 weeks. thanks import flash.events.KeyboardEvent; var char:mario = new mario(); addChild(char); char.x = 300; char.y = 720; var money:coin = new coin(); var Coin:Array = new Array(money,money,money,money,money); addChild(Coin[2]); trace(Coin[2]); for(var b:int = 0; b<5; b++) { addChild(Coin[b]); Coin[b].x = 300; Coin[b].y = 100*b; } stage.addEventListener(KeyboardEvent.KEY_DOWN,movement); var a:int; function movement(e:KeyboardEvent) { if(e.keyCode == 38) { char.y -= 5; } if(e.keyCode == 40) { char.y += 5; } if(e.keyCode == 37) { char.x -= 5; } if(e.keyCode == 39) { char.x += 5; } if(Coin.hitTestObject(char)) { Coin[b].y = -5000; a++; } trace("coins= " + a); } actionscript-3 flash-cs6 share|improve this question asked Nov 28 '14 at 18:11 Lev 54 add a comment| 1 Answer 1 active oldest votes up vote 1 down vote accepted Wow, you got this capitalization of the first letter completely backwards. Your instanc
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 http://stackoverflow.com/questions/27194009/hittestobject-is-not-a-function them; it only takes a minute: Sign up Actionscript 3.0: TypeError: Error #1006: addToValue not a function up vote 0 down vote favorite I'm sure there's some dumb mistake hiding from me, but I've been at it for over 2 hours and cannot seem to find what's going wrong. Someone please help me determine what I am doing wrong, the http://stackoverflow.com/questions/17735349/actionscript-3-0-typeerror-error-1006-addtovalue-not-a-function error is in the title and the following is my relavent code. FURTHER USEFUL DETAILS: Exact error is the following: TypeError: Error #1006: addToValue is not a function. at SimpleMenuMain/onTick() at flash.utils::Timer/_timerDispatch() at flash.utils::Timer/tick() The game runs, but does not count score, I want the score to be counted. I have triple checked that all my instance names are correct, I really don't see anything wrong with what I've done there. Possibly I somehow could be referencing them incorrectly, but all the names used in the code ARE ON my objects inside symbols and texts...etc. Thank you so much for your time, this has really been killing me. P.S.---I'm following a tutorial so if I'm doing something unnecessary don't blame me! Although other comments in addition to helping me answer this conundrum are welcome =). DOCUMENT CLASS package { import flash.display.MovieClip; public class SMGDocClass extends MovieClip { public var playScreen:SimpleMenuMain; public var titleScreen:TitleScreen; public var gameOver:GameOver; public function SMGDocClass() { titleScreen = new TitleScreen(); titleScreen.addEventListener(NavigationEvent.START,onRequestStart,false,0,true); titleScreen.x = 0; titleScreen.y = 0; addChild(titleScreen); } public function onStickman1Death(stick
ElementsAdobe Dreamweaver Adobe MuseAdobe Animate CCAdobe Premiere ProAdobe After EffectsAdobe IllustratorAdobe InDesignView all communitiesExplore Menu beginsMeet the expertsLearn our productsConnect with your peersError: You don't have JavaScript enabled. This tool uses JavaScript and much of it will not work correctly https://forums.adobe.com/thread/682277 without it enabled. Please turn JavaScript back on and reload this page. Please enter a title. You can not post a blank message. Please type your message and try again. More http://www.actionscript.org/forums/actionscript-3-0-a/191167-typeerror-error-1006-objecthittest-function.html discussions in ActionScript 3 All CommunitiesAdobe Animate CC - HomeActionScript 3 2 Replies Latest reply on Jul 17, 2010 9:57 PM by theBigBoppa Question about bloodybleeding hitTestObject theBigBoppa Jul 17, is not 2010 2:47 PM Hello,I have a question I'm trying to program this code:public function enemiesDie(){ enemyLoop: for (var k:int = enemies.length -1;k>= 0; k--){ bulletLoop: for (var i:int = bullets.length -1; i>=0; i--){ if (enemies[k].hitTestObject(bullets[i])){ trace("hit"); if(enemies[k].faceRight){ enemies[k].scaleX = -1; enemies[k].gotoAndStop(enemies[k].dieBackHit[Math.floor(enemies[k].animstep)]); }else if (enemies[k].faceLeft){ enemies[k].gotoAndStop(enemies[k].dieFrontHit[Math.floor(enemies[k].animstep)]); bulletHit(i); } } is not a } }to detect when a bullet hits an enemy in a game I'm trying to make and I get this error:TypeError: Error #1006: hitTestObject is not a function. at Space_Hooligans/enemiesDie() at Space_Hooligans/gameLoop()If anyone could help and can see what I'm doing wrong I'd be very grateful. Thank you I have the same question Show 0 Likes(0) 626Views Tags: none (add) This content has been marked as final. Show 2 replies 1. Re: Question about bloodybleeding hitTestObject kglad Jul 17, 2010 3:04 PM (in response to theBigBoppa) are your enemies array elements displayobjects. Like Show 0 Likes(0) Actions 2. Re: Question about bloodybleeding hitTestObject theBigBoppa Jul 17, 2010 9:57 PM (in response to kglad) i found out what the problem was, but thanks very much anyway. Like Show 0 Likes(0) Actions Go to original post Actions More Like This Retrieving data ... Legend Correct Answers - 10 points © 2016 Adobe Systems Incorporated. All Rights Reserved. | Powered by Help | Terms of Use | Privacy Policy and Cookies (UPDATED) | Forum Help | Tips for AskingJive Software Version: 8.0.3.0 , revision: 20160218075410.6eafe9c.release_8.0.3.x
ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0 TypeError: Error #1006: objectHitTest is not a function. 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 Rate Thread Display Modes 12-07-2008, 03:59 PM #1 grebs Registered User Join Date: Apr 2008 Posts: 12 TypeError: Error #1006: objectHitTest is not a function. i have written this code in an as file - package { import flash.display.Stage; import flash.display.Sprite; import flash.ui.*; import flash.events.*; public class Wheel extends Sprite{ private var wheel:Wheel; private var ground:Ground; public function objectHitTest() { wheelHitGround(); } private function wheelHitGround():void { stage.addEventListener(Event.ENTER_FRAME, hitGround); } private function hitGround(evt:Event):void { if(this.hitTestObject(ground)) { trace("hit"); } } } } Then i have referenced this in the fla file using this code - var wheel:Wheel = new Wheel(); addChild(wheel); wheel.x = 50; wheel.y = 200; this.objectHitTest(); and i keep getting this error message TypeError: Error #1006: objectHitTest is not a function. at gameOO_fla::MainTimeline/gameOO_fla::frame1() but i have no idea why. has anyone got any ideas? grebs View Public Profile Find More Posts by grebs 12-08-2008, 08:13 AM #2 xiaoyy1001 Registered User Join Date: Dec 2008 Posts: 4 var wheel:Wheel = new Wheel(); addChild(wheel); wheel.x = 50; wheel.y = 200; this.objectHitTest(); right code - wheel.objectHitTest(); current document donot have a function named "objectHitTest". it's a part of class Wheel xiaoyy1001 View Public Profile Find More Posts by xiaoyy1001 « Previous Thread | Next Thread » Thread Tools Show Printable Version Email this Page Display Modes Linear Mode Switch to Hybrid Mode Switch to Threaded Mode