Relative path problem with function

Hi, this is a problem I cant resolve for a long time, Im using an interval function like this:

hold = function (timeset) {
idInterval = setInterval(function () {
gotoAndPlay(“loop”);
clearInterval(idInterval);
}, timeset*60000);
};

hold(.15);

the thing is, I need to write a relative path for the gotoAndPlay(“loop”);
but doesn`t work, it works with absolute pathing, but not relative…
help???

alia

I think you must pass the MC reference to the setInterval function, but if you want to HOLD for some time I didn´t see how you get to reach clearInterval

something like

 var interval: Number ;

timeset = 1 ;

interval = setInterval ( goToLoop, timeset*60, this) ;

stop();

function goToLoop ( mc:MovieClip )
{
      trace ( "entering gotoLoop");
      mc.gotoAndPlay("loop");
      
      trace ( "clearInterval");
      clearInterval(interval);
}

it works but if you go back to the FRAME where this code resides it will never stops because setInterval will be called again

so at “loop” you should have some condition to go to another frame if you intend it stops sometime.

Generally when you use setInterval you should care about first about the conditions to CLEAR it

I hope it helps :thumb2:

wow! it works very good! thanks
I arrange the script to run in the begginning of the movie, then I made a loop that at the end of the timeline returns to the start, but 2 frames after the function of set interval.
thanks!!!(-: