Might as well throw in Delegate while you're at it: import mx.utils.Delegate; var intervalID:Number;
function rolloverHandler() { // always clear interval before setting a new one clearInterval(intervalID); intervalID = setInterval(this , "nextScene" , 5000 ); } function rolloutHandler() { clearInterval(intervalID); } my_mc.onRollOver = Delegate.create(this, rolloverHandler); my_mc.onRollOut = Delegate.create(this, rolloutHandler); rolloverHandler(); regards, Muzak ----- Original Message ----- From: "Mauricio Furtado Massaia" <[EMAIL PROTECTED]> To: <flashcoders@chattyfig.figleaf.com> Sent: Tuesday, March 27, 2007 12:46 AM Subject: Re: [Flashcoders] another setInterval question >i think so , like this : > > var intervalID; > > function initInterva() > { > intervalID = setInterval( this , "nextScene" , 5000 ); > } > > function stopInterval() > { > clearInterval( intervalID ); > } > > > // onRollOver will stop the interval > my_mc.onRollOver = function (){ > stopInterval(); > } > > // onRollOut restart the interval > my_mc.onRollOut = function(){ > initInterval(); > } > > > // start your interval > initInterval(); > > > I wish it helps > > hugs > > MauricioMassaia > > > > > On 3/26/07, Raphael Villas <[EMAIL PROTECTED]> wrote: >> >> I have got a setInterval like this: >> >> ------------- >> var autoID = setInterval(autoPilot,5000); >> >> function autoPilot():Void { >> nextScene(); >> }; >> ------------- >> >> If a rollover occurs, I'd like to pause the setInterval until the >> rollout occurs. Is there a way to suspend the setInterval during a >> rollover and then restart it onRollOut? >> >> Thanks in advance... _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com