# Isn't it possible to simply unload a movie and load a new one with the SAME button?

**URL:** <https://forum.kirupa.com/t/isnt-it-possible-to-simply-unload-a-movie-and-load-a-new-one-with-the-same-button/320703>\
**Category:** flash\
**Created:** [March 30, 2011, 10:10pm UTC](https://forum.kirupa.com/t/isnt-it-possible-to-simply-unload-a-movie-and-load-a-new-one-with-the-same-button/320703 "2011-03-30T22:10:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![O\_Tamandua](https://avatars.discourse-cdn.com/v4/letter/o/ecccb3/32.png) [@O\_Tamandua](https://forum.kirupa.com/u/O_Tamandua)\
**Post date:** [March 30, 2011, 10:10pm UTC](https://forum.kirupa.com/t/isnt-it-possible-to-simply-unload-a-movie-and-load-a-new-one-with-the-same-button/320703/1 "2011-03-30T22:10:29Z")

</div>

Hello, all.

I’ve gone fully gray trying to learn how to do something in AS3 that was routine in AS2: unloading (if something’s already there) something from a movie clip then LOADING something in the same clip, all with the same button.

I’m not complaining as I know AS3 is much more robust - however, this is seriously troubling me. :jailbreak

Here’s the code I’m using, er, attempting to use now. These are for two buttons out of a set of 9. All I’m trying to do is the simple: look to see if there’s something in the clip “hovercap”, and if so, remove it completely;, then load a new movie. (If there ISN’T something in “hovercap”, I want to load a new movie anyway.):

> 

invisible\_mvp1800c.addEventListener(MouseEvent.MOUSE\_DOWN, loadImage); {  
function loadImage([url:String):void](http://www.kirupa.com/forum/String):void) {  
if(imageLoader != null && contains(imageLoader)){  
removeChild(imageLoader);  
}

```
// Set properties on my Loader object

 var imageLoader:Loader = new Loader();
 imageLoader.load(new URLRequest("hovercap_1800c.swf"));

```

hovercap.addChild(imageLoader);  
}  
}

invisible\_mvp1825c.addEventListener(MouseEvent.MOUSE\_DOWN, loadImage2); {  
function loadImage2([url:String):void](http://www.kirupa.com/forum/String):void) {  
if(imageLoader != null && contains(imageLoader)){  
removeChild(imageLoader);  
}

```
// Set properties on my Loader object

 var imageLoader:Loader = new Loader();
 imageLoader.load(new URLRequest("hovercap_1825c.swf"));

```

hovercap.addChild(imageLoader);  
}  
}

Clearly, I’m still learning things in AS 3. Thanks in advance to anyone’s help on this - I feel like I’ve searched on every AS 3 forum out there.
