First off I'd like to say I did a search on this and although there are many subjects on the matter, none really apply to mine.
My problem is this: There is an enemy on the stage(enemyTwo) in which I remove if its health meter gets below a certain point. You lower the enemy's health by hitting it with little daggers that you throw.
Everything works fine up to a point, the health bar slowly goes down and the enemy even seems to disappear when the removeChild/enemyTwo = null directives are called, however, there seems to be a small window of time where the daggers will hit an invisible version of the enemy which in turn gives me the "Error #2007: Parameter hitTestObject must be non-null" error which in turn causes other things to go awry or Id just ignore it =).
ActionScript Code: public function checkCollisionWithEnemies(bullet:MovieClip) { if(enemyTwo != null) { if(enemyTwo.hitTestObject(bullet)) { enemyTwo.subObject.meter.width -= 10; removeChild(bullet); if(enemyTwo.subObject.meter.width < 3) { enemyTwo.stop(); removeChild(enemyTwo); enemyTwo = null; } } } }
ActionScript Code: private function onEnter(evt:Event):void { y -= 10; rotation += 20; MovieClip(parent).checkCollisionWithEnemies(this); }
Any insight would be appreciated.
removeChild error 2007
Saturday, June 30, 2012
[Action Script] removeChild error 2007 June,2012
Posted by Bimo Hery Prabowo at 7:13 AM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment