# addChild Confusion

**URL:** <https://forum.kirupa.com/t/addchild-confusion/287753>\
**Category:** flash\
**Created:** [May 5, 2009, 9:40pm UTC](https://forum.kirupa.com/t/addchild-confusion/287753 "2009-05-05T21:40:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmennenoh](https://avatars.discourse-cdn.com/v4/letter/d/9dc877/32.png) [@dmennenoh](https://forum.kirupa.com/u/dmennenoh)\
**Post date:** [May 5, 2009, 9:40pm UTC](https://forum.kirupa.com/t/addchild-confusion/287753/1 "2009-05-05T21:40:56Z")

</div>

Sorry - reposted in AS3 because I posted in CS3 by mistake

I thought I was getting this, but am confused right now, so thought I’d ask here. In a class, I have a function that instantiates a VideoPlayer class:

private function attractPlay(e:KioskEvent)  
{  
stage.addChild(new VideoPlayer());  
}

And then in the VideoPlayer constructor I do:

public function VideoPlayer()  
{  
//setup stuff…  
vid = new Video(1137, 768);  
vid.attachNetStream(ns);  
ns.play(“test.flv”);  
//addChild(vid);  
}

If I do like shown, and omit the addChild() in the constructor then all I get is the sound. If I use the addChild, the video plays. VideoPlayer extends Sprite… and this is where I’m confused. I thought the: stage.addChild(new VideoPlayer()); would be enough, I’m not sure why I also need to addChild(vid) inside the player class itself.

When I want to clear the video, do I need to removeChild on both?

Hope this makes sense…
