i’m having an issue fitting setInterval() methods into an AS2 class–basically, since setInterval works by calling a function at a set interval, and it returns an object reference, like this:
public function loadSplash():Void {
var id=setInterval(loadSplashMC,1000);
var sM:Object=new Object();
Mouse.addListener(sM);
sM.onMouseMove=function(){
Mouse.removeListener(this); //delete after first mouse event
}}
public function loadSplashMC():Void {
clearInterval(id);
}
the problem is that i can’t set a class variable to id–i tried defining it as a generic object, like this:
public var id:Object;
but it didn’t work…
i’m not used to working with setInterval, so maybe i’m just not using it right–perhaps i should put it all into one function?
i think there has to be a better way, and i’d appreciate hearing anything about setInterval() and my problem–thanks!