我想删除名为'_pokemon'的对象。如果被雨打落十次,称为'_jednaLinia'(意思是'_oneLine'),它应该被移除。我确实使用了这个代码,是的,它做了我的_pokemon消失的工作,但它仍然在handleColisin函数中被检测到。而主类仍然不断提及它,因为我得到了口袋妖怪类此错误“错误#1009:无法访问空对象引用的属性或方法”hittest,removechild,不可见对象保持问题,闪存,as3
我不干新AS3和尝试了许多简单的解决方案,但似乎没有工作,我打算如何。 如果可能请回答。
## some code I think is necessary, not all of it
...
public class Main extends Sprite
{
private var _pokemon:Pokemon;
public function Main():void
{
_starTimer = new Timer(30);
addEventListener(Event.ADDED_TO_STAGE, init);
_starTimer.addEventListener(TimerEvent.TIMER, start);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
_starTimer.start();
this.addChild(_pokemon);
}
...and further...
private function _pokemonLive(e:Event = null):void
{
decreaseLive--;
if (decreaseLive == 0)
{
_pokemon.parent.removeChild(_pokemon);/i think i tried all methods
_starTimer.stop();
}
}
而且就像我刚才提到的。口袋妖怪课上有错误,它上面有随机移动功能。这是1009错误的地方。如有需要,我发送更多的代码。
当你叫_pokemonLive?它是一个事件监听器吗? – 2013-05-12 16:35:56
这部分激活_pokemonLive的代码位于privat函数中,该函数使用timeEvent监听器调用,并命名为“start”'code'.................. if(_pokemon。 hitTestObject(_linia [COUNT])) \t \t \t { \t \t \t handleCollision(_linia [COUNT]); \t \t \t \t _pokemonLive(); \t \t \t \t \t \t} – derkarol 2013-05-12 19:55:55
看看我的答案,它应该工作,然后接受它。 – 2013-05-12 21:05:09