Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

control when a swf loads

Status
Not open for further replies.

TigerGirl7

Programmer
Apr 8, 2003
152
US
Hi,

I've created a flash movie that loads a new swf after the current swf plays through. However, i'd like for the new swfs to load say... 30 seconds after the current one finishes, rather than immediately.

Rather than adding a long set of frames to each swf, I'm assuming there is a better way with actionscript to control when a swf loads.

Any suggestions?
Jen
 
in last frame

stop();
hangAround = setInterval(holdOn, 30000);//30 secs

function holdOn(){
clearInterval(hangAround);
loadmovie(.........)
}
 
thanks Bill.

I tried the script but it doesn't appear to be loading my movie. This is what I have:

stop();
hangAround = setInterval(holdOn, 30000);

function holdOn(){
clearInterval(hangAround);
loadMovie(home.swf, 1);
}

I need my swf to load on level 1.
 
First, the function only need to be defined once, usually on the first frame of your movie. And if you want to load on another level, then you should use loadMovieNum and not loadMovie which is used to load an external movie in an empty container clip. And don't forget the doubles quotes around the movie's name.
Code:
function holdOn(){ 
    loadMovieNum("home.swf", 1); 
    clearInterval(hangAround); 
}


Then on an end keyframe, you can use...
Code:
stop(); 
hangAround = setInterval(holdOn, 30000);


Regards,

cubalibre2.gif
 
Thanks OldNewbie.

I'm getting closer but I'm still having some trouble. There seems to be some sort of conflict somewhere. What's happening is that the first swf loads fine, waits 30 sec then plays the 2nd swf. The 2nd swf plays through then, waits 30 sec and then it loads the same swf again for a few secs. Then it loads the correct swf then it all goes haywire.

I'm using flash mx. Could it be that I need to publish as Flash 6?
 
yes you have to publish as flash 6

make sure that you are changing the name of the swf to be loaded each time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top