# RemoveChild

**URL:** <https://forum.kirupa.com/t/removechild/288028>\
**Category:** flash\
**Created:** [May 9, 2009, 5:33pm UTC](https://forum.kirupa.com/t/removechild/288028 "2009-05-09T17:33:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![handynut](https://avatars.discourse-cdn.com/v4/letter/h/5daacb/32.png) [@handynut](https://forum.kirupa.com/u/handynut)\
**Post date:** [May 9, 2009, 5:33pm UTC](https://forum.kirupa.com/t/removechild/288028/1 "2009-05-09T17:33:23Z")

</div>

Hi  
Wonder if anyone can help me with this? New to Actionscript.  
I am creating an expandable banner, I am able to load the expanded swf upon rollover, however I am trying to figure out how to remove the loaded swf on rollout, and therefore return to the unexpanded state.

Here is my actionscript:

function onOver(evt:MouseEvent) :void {  
var photo:Loader = new Loader();  
photo.load(new URLRequest(“expanded.swf”));  
holder.addChild(photo);  
}  
rollover\_btn.addEventListener(MouseEvent.MOUSE\_OVER, onOver);

function onOut(event:MouseEvent):void  
{  
holder.removeChild(photo);  
}  
holder.addEventListener(MouseEvent.MOUSE\_OUT, onOut);

Any help would be much appreciated.

Thanks
