View Full Version : setInterval () question
friz2002
12-26-2002, 11:37 PM
Hi,
I have a .swf, when it's fully loaded I want the movie to wait 2 seconds and then load another .swf on level1
This is what I have so far
start = function(){
loadMovieNum("intro.swf",1);
}
totaal = getBytesTotal();
geladen = getBytesLoaded();
if(geladen == totaal){
setInterval(start,2000);
}
The problem is that the intro.swf keeps loading every 2 seconds, and I just want it to load once.
Any ideas?
Thx
cheez
12-27-2002, 12:21 AM
Howdy, may not help much, but try putting a:
////////////////////
trace (totaal); trace (geladen);
////////////////////
...directly after the calls to the getBytes function and before "if" statement.
If for some reason totaal == "undefined" and geladen == "undefined", this would satisfy the if statement and therefore start loading.
Hmmm, just looked at it again, if everything is working correctly (totaal == geladen) you still have satisfied the if statement and it will load. Even after loading, you have still satisfied the if statement. How about after loading the movie you change a variable from "unloaded" to "loaded". Re condition the if statement like:
start = function(){
loadMovieNum("intro.swf",1); status = "loaded";
}
totaal = getBytesTotal();
geladen = getBytesLoaded();
if(geladen == totaal && status != "loaded") {
setInterval(start,2000);
}
Hehe, long-winded but might work! ;)
-Cheez
Originally posted by friz2002
Hi,
I have a .swf, when it's fully loaded I want the movie to wait 2 seconds and then load another .swf on level1
This is what I have so far
start = function(){
loadMovieNum("intro.swf",1);
}
totaal = getBytesTotal();
geladen = getBytesLoaded();
if(geladen == totaal){
setInterval(start,2000);
}
The problem is that the intro.swf keeps loading every 2 seconds, and I just want it to load once.
Any ideas?
Thx
If I were you I load the Movie and check if laoded with
onData.
Then if _totalBytes == _bytesLoaded
then I do a pause.
Look for it into the forum. Someone found a good solution for this pb.
The way given by cheez might not work. Why?
Because a setInterval when init call the function every 2000 (here). To delete it you have to do something like this:
start = function(){
loadMovieNum("intro.swf",1);
clearInterval(MyID);
}
totaal = getBytesTotal();
geladen = getBytesLoaded();
if(geladen == totaal){
MyID = setInterval(start,2000);
}
But this script doesn't work for your project. As I said, look for pause in the forum...
;)
friz2002
12-27-2002, 12:55 PM
Thx for the replies cheez and xxlm :)
xxlm, this script actually did work for my project :D
start = function(){
loadMovieNum("intro.swf",1);
clearInterval(MyID);
}
totaal = getBytesTotal();
geladen = getBytesLoaded();
if(geladen == totaal){
MyID = setInterval(start,2000);
}
I knew someone asked something like this before and I did a search before I posted, but couldn't find it. I'll try a search with "pause" for other posibilities
cheez
12-27-2002, 07:20 PM
Hehe, I think I trust XXLM before me!
I learn something too as well...:)
Thanks,
Cheez
Originally posted by friz2002
Thx for the replies cheez and xxlm :)
xxlm, this script actually did work for my project :D
start = function(){
loadMovieNum("intro.swf",1);
clearInterval(MyID);
}
totaal = getBytesTotal();
geladen = getBytesLoaded();
if(geladen == totaal){
MyID = setInterval(start,2000);
}
I knew someone asked something like this before and I did a search before I posted, but couldn't find it. I'll try a search with "pause" for other posibilities
Glad too help you too...
;)
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.