# Conditonal statements for loading and unloading swfs

**URL:** <https://forum.kirupa.com/t/conditonal-statements-for-loading-and-unloading-swfs/236563>\
**Category:** Uncategorized\
**Created:** [August 21, 2007, 9:51pm UTC](https://forum.kirupa.com/t/conditonal-statements-for-loading-and-unloading-swfs/236563 "2007-08-21T21:51:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![corinn](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@corinn](https://forum.kirupa.com/u/corinn)\
**Post date:** [August 21, 2007, 9:51pm UTC](https://forum.kirupa.com/t/conditonal-statements-for-loading-and-unloading-swfs/236563/1 "2007-08-21T21:51:53Z")

</div>

i have a bunch of \_mc that load .swfs into the same shell2\_mc

im trying to figure out how to replace one .swf with another…(swapping) or unloading the previous swf before loading the next swf onClick

possibly using an (if) statement ? …or var swap:boolean = true;  
any suggestions

bio\_mc.addEventListener(MouseEvent.CLICK, onClick);  
function onClick(event:MouseEvent):void  
{  
var imageRequest:URLRequest = new URLRequest(“bio2.swf”);  
var imageLoader:Loader = new Loader();  
imageLoader.load(imageRequest);  
shell2\_mc.addChild(imageLoader);

}
