hi guys,
I found a problem again,the situation is that my player(man) inside GameStage MovieClip hits the GameStage.MyCar as it hits i want player to remove then the rest of the task will be accomplished by the GameStage.MyCar.The error is that
var man:Object;
var MyCar:Object;
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at ManGameStreetboy/gameLoop()
;
public function createman()
{
man = new Object();
man.mc = GameStage.man;
}
public function createCar()
{
MyCar = new Object();
MyCar.mc = GameStage.car;}
this.addEventListener(Event.ENTER_FRAME, gameLoop);
public function gameLoop(event:Event)
{
if (lastTime == 0) lastTime = getTimer();
var timeDiff:int = getTimer()-lastTime;
lastTime += timeDiff;
if((man.mc.hitTestPoint(MyCar.mc.x,MyCar.mc.y,true))||(man.mc.x>MyCar.mc.x+15))
{moveCar(MyCar,timeDiff);
GameStage.removeChild(GameStage.man);
}
else if(!(man.mc.hitTestObject(MyCar.mc)))
{
moveCharacter(man,timeDiff);
}
}