setInterval woooooes

Hi y’all. This problem of mine is making the rounds! :slight_smile: This is actually the second forum…still cant figure it out :confused:

Basically what I am trying to do is use setInterval to start playing mc’s that are already place on the stage. The clips are named waiting1, waiting2, waiting3, etc. All mc’s are placed on the _root as well as the following code.

var mN = 0

function startMovie() {
mN = mN+1
nextClip = “waiting”+mN;
nextClip.gotoAndPlay(2);
}

setInterval(startMovie, 3000)

stop();

This all works but it doesnt :slight_smile: If I trace nextClip, I get waiting1, waiting2, etc…so the interval and function are working, but the movies arent playing :? Im baffled :? Can anyone see anything weird about this? Thanks in adv!

best,
JTK

try this:

mN = 0;
function startMovie() {
mN += 1;
_root[“waiting”+mN].play();
}
setInterval(startMovie, 1000);

Adam

my lord…i love you :slight_smile: that worked!

So question is…why? Give a kid a fish he will eat for a day (and be able to sleep tonight! :)), teach a kid to fish, he will eat for a lifetime :smiley:

Thx again

LOVE that quote…to be honest, I’m not sure why your code wasn’t working…I’m still learning myself, and your code looked fine to me, like you seem to have the variables and references right…I dunno, I just know what I’ve learned and knew it would work this way…wish I had a better answer for you, it’s nice to see someone that wants to know why the code works, rather than “here is my file, fix it. don’t care why…as long as it works.”

Adam