# A remove Child Caller question

**URL:** <https://forum.kirupa.com/t/a-remove-child-caller-question/318317>\
**Category:** flash\
**Created:** [January 16, 2011, 10:01pm UTC](https://forum.kirupa.com/t/a-remove-child-caller-question/318317 "2011-01-16T22:01:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rimacy](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@rimacy](https://forum.kirupa.com/u/rimacy)\
**Post date:** [January 16, 2011, 10:01pm UTC](https://forum.kirupa.com/t/a-remove-child-caller-question/318317/1 "2011-01-16T22:01:53Z")

</div>

Here’s the class

```auto
package
{
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.media.SoundTransform
	import com.greensock.easing.*;
	
	public class StarFieldView extends MovieClip
	{
		private var star:Star;
		private var _starFieldController:Object;
		private var _starFieldModel:Object;
		//private var tween:TweenLite = new TweenLite();
		
		//private var _stage:Object;
		
		
	
		public function StarFieldView(StarFieldModel:Object,StarFieldController:Object):void
		{
			//_stage=Stage;
			_starFieldModel = StarFieldModel;
			_starFieldModel.addEventListener(Event.CHANGE, changeHandler);
			_starFieldController = StarFieldController;
			addEventListener(Event.ADDED_TO_STAGE,starFieldViewAddedToStage)
			
		}
		
		private function starFieldViewAddedToStage(e:Event):void 
		{
			star = new Star();
			star.scaleX=.25;
			star.scaleY=star.scaleX;
			star.x = 600;
			star.y = 100;
			
			addEventListener(Event.ENTER_FRAME,enterFrameEvent)
			
			
			[COLOR="Blue"]addChild(star);[/COLOR]
			removeEventListener(Event.ADDED_TO_STAGE, starFieldViewAddedToStage);
			
		}
		
		private function enterFrameEvent(e:Event):void 
		{
			_starFieldController.moveIt();
		}
		
		private function changeHandler(e:Event):void 
		{
				
				star.x = _starFieldModel.starX;
				if(star.x<10)
				{
					[COLOR="blue"]removeChild(star);[/COLOR]
					trace("child removed");
				}
				
		}
		
		
	}
}

```

when i do this it does remove the child BUT i get the old “The supplied DisplayObject must be a child of the caller.” business. How would i do this properly???
