# Proper unloading to load new swf

**URL:** <https://forum.kirupa.com/t/proper-unloading-to-load-new-swf/28327>\
**Category:** Uncategorized\
**Created:** [August 12, 2003, 5:19pm UTC](https://forum.kirupa.com/t/proper-unloading-to-load-new-swf/28327 "2003-08-12T17:19:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jillymo](https://avatars.discourse-cdn.com/v4/letter/j/5f9b8f/32.png) [@jillymo](https://forum.kirupa.com/u/jillymo)\
**Post date:** [August 12, 2003, 5:19pm UTC](https://forum.kirupa.com/t/proper-unloading-to-load-new-swf/28327/1 "2003-08-12T17:19:57Z")

</div>

Okay I have a main movie that I has 2 external swf’s loaded into it.  
Once those play I want them to sit for a few seconds (maybe about 3)  
and then I want to unload them and load a new swf. I can’t just load into the same empty movie clip, because for 1, there is one swf replacing two and for 2, the position will be different.

Here is what I have so far:  
\<hr\>  
this.createEmptyMovieClip(“clip1”, 1);  
this.createEmptyMovieClip(“clip2”, 2);

clip1.loadMovie(“welcometo.swf”);  
clip1.\_x = 350 ;  
clip1.\_y = 300 ;  
clip2.onEnterFrame = function() {

```
    if (clip1._currentframe == clip1._totalframes) {
            // stop first animation
            clip1.stop();
            // load second animation
            this.loadMovie("hospitality.swf");
clip2._x = 450 ;
            clip2._y = 425 ;
    }

```

};  
\<hr\>

now, I tried adding:  
this.clip1.unloadMovie(“welcometo.swf”);  
this.clip2.unloadMovie(hospitality.swf");

this.createEmptyMovieClip(“clip3”, 1);  
clip3.loadMovie(“hosted.swf”);  
clip3.\_x = 400 ;  
clip3.\_y = 350 ;

But all that did was cause the swf loaded into clip1 not to play.  
Maybe I should add the code a few frames down and use an onClipEvent (enterFrame) command or something?  
Not sure…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 12, 2003, 7:30pm UTC](https://forum.kirupa.com/t/proper-unloading-to-load-new-swf/28327/2 "2003-08-12T19:30:52Z")

</div>

Have you tried removeMovieClip(); ?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 12, 2003, 7:59pm UTC](https://forum.kirupa.com/t/proper-unloading-to-load-new-swf/28327/3 "2003-08-12T19:59:42Z")

</div>

no I have not tried removeMovieClip();  
but I will…

thanks

:esmirk:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 12, 2003, 8:23pm UTC](https://forum.kirupa.com/t/proper-unloading-to-load-new-swf/28327/4 "2003-08-12T20:23:36Z")

</div>

ack I am so lost. I know what I want to do but I just cannot figure out where to start with how to do it.

I want the code to play as above- load welcome.swf and hospitality.swf into my main movie and be there for about 3-4 seconds.

Then, I want to unload those swf’s and load a new one.

I have been searching through these threads all day and am finding a lot of info, but am having a tough time applying it to what I need.

I found a link to this which was referred to as great code for pausing a movie, but how do I target the specific swf’s?  
Can anyone please help me??  
\<hr\>  
this.createEmptyMovieClip(“timer”,50);  
timer.onEnterFrame = function()  
{  
if (this.startTime\>0)  
{  
var diff = getTimer()-this.startTime;  
if (diff\>this.timerLength)  
{  
this.target.play();  
this.startTime = 0;  
}  
}  
};  
function pauseFor(theTime)  
{  
stop();  
timer.timerLength = theTime;  
timer.startTime = getTimer();  
timer.target = this;  
}  
\<hr\>
