# Loading and unloading swf

**URL:** https://forum.kirupa.com/t/loading-and-unloading-swf/302039
**Category:** Uncategorized
**Created:** [December 20, 2009, 8:17pm UTC](https://forum.kirupa.com/t/loading-and-unloading-swf/302039 "2009-12-20T20:17:00Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![flashoume](https://avatars.discourse-cdn.com/v4/letter/f/db5fbb/32.png) [@flashoume](https://forum.kirupa.com/u/flashoume)
#### Post date: [December 20, 2009, 8:17pm UTC](https://forum.kirupa.com/t/loading-and-unloading-swf/302039/1 "2009-12-20T20:17:00Z")

</div>

Hello I’m relatively new at AS3 having become used to AS2.  
I want to load a swf file on the push of a button found on my main swf file.  
I would need to unload the main swf file so that the swf file indicated by the navigation bouton can be seen without the main file in the background !!  
I keep getting the same errors

1023: override non compatible.  
1021: Définition de fonction dupliquée.

on all of my three boutons!

I’m sure there is a code that works but I just can’t seem to get around it !

here is my code :

//fonctions  
function sitedynamique(e:Event) {  
while (this.loadArea1.numChildren \> 0) {  
this.loadArea1.removeChildAt(0);  
}  
var loadit:Loader = new Loader();  
loadit.load(new URLRequest(“sitedynamique.swf”));  
loadArea1.addChild(loadit);  
}  
function sitevitrine(e:Event) {  
while (this.loadArea1.numChildren \> 0) {  
this.loadArea1.removeChildAt(0);  
}  
var loadit:Loader = new Loader();  
loadit.load(new URLRequest(“sitevitrine.swf”));  
loadArea1.addChild(loadit);  
}  
function contact(e:Event) {  
while (this.loadArea1.numChildren \> 0) {  
this.loadArea1.removeChildAt(0);  
}  
var loadit:Loader = new Loader();  
loadit.load(new URLRequest(“contact.swf”));  
loadArea1.addChild(loadit);  
}

//Buttons  
sitedynamique.addEventListener(MouseEvent.CLICK, sitedynamique);  
sitevitrine.addEventListener(MouseEvent.CLICK, sitevitrine);  
contact.addEventListener(MouseEvent.CLICK, contact);

if anyone out could help me out that would be fantastic !!

thanks in advance !!
