# Set loadMovie time, unloadMovie, loadMovie

**URL:** <https://forum.kirupa.com/t/set-loadmovie-time-unloadmovie-loadmovie/28351>\
**Category:** Uncategorized\
**Created:** [August 12, 2003, 9:05pm UTC](https://forum.kirupa.com/t/set-loadmovie-time-unloadmovie-loadmovie/28351 "2003-08-12T21:05:02Z")\
**Posts on this page:** 3\
**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, 9:05pm UTC](https://forum.kirupa.com/t/set-loadmovie-time-unloadmovie-loadmovie/28351/1 "2003-08-12T21:05:02Z")

</div>

in that order-

Put simply-  
can anyone guide me to any resources that would explain how to do this?

1. Load 2 swf’s into empty mc’s (this part is already done)
2. Have those 2 swf’s be on the stage for 3 seconds.
3. Unload those 2 swf’s.
4. Then load a completely new swf once those have been unloaded.

---

<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, 10:51pm UTC](https://forum.kirupa.com/t/set-loadmovie-time-unloadmovie-loadmovie/28351/2 "2003-08-12T22:51:47Z")

</div>

You can use the setInterval method. Like so:

function unloadSWFs () {  
// code to unload here.  
// followed by code to load the next movies.  
}

myInterval = setInterval(unloadSWFs, 3000);

Just put that in the same frame.

Regards,  
Viru.

---

<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 13, 2003, 6:02pm UTC](https://forum.kirupa.com/t/set-loadmovie-time-unloadmovie-loadmovie/28351/3 "2003-08-13T18:02:56Z")

</div>

Well that seems like it would work so well. This is what I have and this (attached) is the result. I think I am going to bail with my using 2 loadMovies and one mc for the intro and replace with one loaded swf. That way, when I want to load a new one I can just load it into the same mc.

I do thank you for your help!!

\<hr\>  
function getdistance(x,x1) {  
var run;  
run = x1-x;  
return (\_root.hyp(run));  
}  
function hyp(a, b) {  
return (Math.sqrt(a_a+b_b));  
}  
MovieClip.prototype.reset = function() {  
//specify the width and height of the movie  
width = 1024;  
height = 300;  
//-------------------  
var dist, norm;  
this.x = this.\_x;  
this.speed = Math.random()\*4+1;  
this.targx = Math.random()\*width;  
dist = \_root.getdistance(this.x,this.targx);  
norm = this.speed/dist;  
this.diffx = (this.targx-this.x)\*norm;  
};  
MovieClip.prototype.move = function() {  
if (\_root.getdistance(this.x,this.targx)\>this.speed) {  
this.x += this.diffx;  
} else {  
this.x = this.targx;  
if (!this.t) {  
this.t = getTimer();  
}  
if (getTimer()-this.t\>1000) {  
this.reset();  
this.t = 0;  
}  
}  
this.\_x = this.x;  
};

// create a MovieClip to load each SWF  
this.createEmptyMovieClip(“clip1”, 1);  
this.createEmptyMovieClip(“clip2”, 2);  
// load first animation  
clip1.loadMovie(“welcometo.swf”);  
clip1.\_x = 350 ;  
clip1.\_y = 300 ;  
clip2.onEnterFrame = function() {  
// check if the animation has finished  
if (clip1.\_currentframe == clip1.\_totalframes) {  
// stop first animation  
clip1.stop();  
// load second animation  
this.loadMovie(“hospitality.swf”);  
clip2.\_x = 450 ;  
clip2.\_y = 425 ;  
}  
};  
function unloadSWFs () {  
root.clip1.unloadMovie(“welcometo.swf”);  
root.clip2.unloadMovie(“hospitality.swf”);  
}  
myInterval = setInterval(unloadSWFs, 3000);  
this.createEmptyMovieClip(“clip3”, 1);  
clip3.loadMovie(“hosted.swf”);  
clip3.\_x = 300;  
clip3.\_y = 300 ;  
\<hr\>
