# removeChild Problem

**URL:** https://forum.kirupa.com/t/removechild-problem/301158
**Category:** Uncategorized
**Created:** [December 4, 2009, 7:50am UTC](https://forum.kirupa.com/t/removechild-problem/301158 "2009-12-04T07:50:01Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ash\_at\_risk](https://avatars.discourse-cdn.com/v4/letter/a/2bfe46/32.png) [@ash\_at\_risk](https://forum.kirupa.com/u/ash_at_risk)
#### Post date: [December 4, 2009, 7:50am UTC](https://forum.kirupa.com/t/removechild-problem/301158/1 "2009-12-04T07:50:01Z")

</div>

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;

```php
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
	at flash.display::DisplayObjectContainer/removeChild()
	at ManGameStreetboy/gameLoop()

```

;

```php
public function createman() 
    {
	man = new Object();
	man.mc = GameStage.man;
     }

```

```php
public function createCar()
	{
	  MyCar = new Object();
	  MyCar.mc = GameStage.car;}

```

```php
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);
		      }
		}

```
