When defining a scope, the function needs to be passed as a string.
You should also clear the interval before setting a new one.

clearInterval(_global.gIdleInterval);
_global.gIdleInterval = setInterval(_global, "IdleFunction", 
_global.gIdleTimeout);

regards,
Muzak


----- Original Message ----- 
From: "Paul Steven" <[EMAIL PROTECTED]>
To: "'Flashcoders mailing list'" <flashcoders@chattyfig.figleaf.com>
Sent: Saturday, August 12, 2006 10:25 AM
Subject: [Flashcoders] Problems with setInterval


>I am trying to scope my setInterval timeout handler however it is not
> calling the associated handler when I add the scoping in to it.
>
> Here is the code I have so far:
>
> _global.gIdle_Timeout = 10000 // 10 seconds
>
>
>
> _global.Idle_Function = function(passed_Destination) {
>
>     trace ("Idle function called");
>
>            Clear_Timeout_Interval();
>
>            gotoAndPlay(Idle_Timeout_Destination);
>
> }
>
>
>
> _global.Clear_Timeout_Interval = function() {
>
>     trace ("Clear timeout interval");
>
>            clearInterval(_global.gIdle_Interval);
>
> }
>
>
>
> _global.Start_Idle_Timeout = function(passed_Destination) {
>
>     trace ("start idle");
>
>            Idle_Timeout_Destination = passed_Destination;
>
>            // _global.gIdle_Interval = setInterval(this,
> _global.Idle_Function, _global.gIdle_Timeout);
>
>     _global.gIdle_Interval = setInterval(_global.Idle_Function,
> _global.gIdle_Timeout);
>
> }
>
> I have commented out the line of code with the scoping in it.
>
> i.e
>
>
> _global.gIdle_Interval = setInterval(this, _global.Idle_Function,
> _global.gIdle_Timeout);
>
> Without the scoping, it does not always appear to clear the interval.
>
> Here is a screenshot of my timeline with the actions window illustrating my
> call to this function
>
> http://www.mediakitchen.co.uk/interval.jpg
>
> Any assistance much appreciated.
>
> Thanks
>
> Paul


_______________________________________________
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

Reply via email to