This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Flash Site Design > June 2005 > Why this code isn't working?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Why this code isn't working?
mballom3

2005-06-25, 11:14 pm

Hi all,

Would be nice if anyone can explain me why i can't get this setInterval code
working:

stop();
function myFunction {play();
}
ID = setInterval (myFunction, 3*1000)
clearInterval(ID);

This goes on frame 50 on main timeline. I want this frame to pause 3 seconde,
then keep playing from nextframe.
Well nothing of this happens. The timeline simply plays throught as tho
nothing was there.

Thanks for answers

tralfaz

2005-06-25, 11:14 pm


"mballom3" <webforumsuser@macromedia.com> wrote in message
news:d9khg0$f6c$1@forums.macromedia.com...
> Hi all,
>
> Would be nice if anyone can explain me why i can't get this
> setInterval code
> working:


You were clearing the interval right after you set it so it never gets
called.
Just move the clearInterval up to the function..
tralfaz

stop();
function myFunction()
{
play();
clearInterval(ID);
}

ID = setInterval (myFunction, 3*1000)


mballom3

2005-06-25, 11:14 pm

great thank you tralfaz
Jeckyl

2005-06-25, 11:14 pm

> stop();
> function myFunction {play();
> ID = setInterval (myFunction, 3*1000)
> clearInterval(ID);


because you set the interval in the function that the interval is calling ..
so it never gets called.

stop();
function myFunction {
play();
clearInterval(ID);
}
ID = setInterval (myFunction, 3*1000)

Jeckyl


Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews