Hello everyone...
I dont know if this has been discussed here before...
i was having a conversation with a flash developer and he was going on about how using setInterval is much better than using onEnterFrame for actionscripted animations as the latter suffers from platform dependance (muc slower on Macs and slow processors) and also because once killed (delete onEnterFrame) can't be reinstated.
Yesterday i received some help in this forum and the person who helped me pointed that i should use onEnterFrame as opposite as setInterval as is easier to use and less buggy...
:sigh:
Anybody willing to shed some light on the subject?
Cheers in advance for your advice!! David Stillers blog Blog Archive How to Determine the Completion :: want to test for the time vs. duration comparison under circumstances other than (with MovieClip.onEnterFrame, say, or setInterval()) to repeatedly check the http://www.quip.net/blog/2007/flash/actionscript-20/how-to-determine-completion-of-flvHOME | ActionScript.org Forums - setInterval() vs. onEnterFrame():: setInterval() vs. onEnterFrame() (http://www.actionscript.org/forums/showthread.php3?t=32511) setInterval() vs. onEnterFrame() Hi! I have some questins http://www.actionscript.org/forums/printthread.php3?t=32511HOME |
D
this article http://www.13dots.com/forum/index.php?showtopic=2353 (http://www.13dots.com/forum/index.php?showtopic=2353)
approaches the same issues...with an eye on cpu usage
D
I dont' really have an opinion, but I do have to say this:
and also because once killed (delete onEnterFrame) can't be reinstated.
That is SO WRONG!
You can really easily reinstate an onEnterFarme:
function moveMe()
{
//move the movieclip
this._x += 10;
}
//assign onEnterFrame
myMovieClip.onEnterFrame = moveMe;
//delete onEnterFrame
delete myMovieClip.onEnterFrame;
//reinstate oEF:
myMovieClip.onEnterFrame = moveMe;
At one time i used setInterval for all movement etc but one of the problems is that if you reload a movieclip, then the intervals do not clear on their own.So unless you keep track of all intervals to clear, can mess everthing up.
Now reverted back to onEnterFrame and only use setInterval when necessary.
At one time i used setInterval for all movement etc but one of the problems is that if you reload a movieclip, then the intervals do not clear on their own.So unless you keep track of all intervals to clear, can mess everthing up.
Now reverted back to onEnterFrame and only use setInterval when necessary.Why not write a custom class that keeps track of all the intervals ?
I use onEnterFrame unless i need like a timed event of a such a sort, i rarely ever use setInterval though
Why not write a custom class that keeps track of all the intervals ?
because i cannot (-:
I just made this one. (It seems to be working, though I havent tested it much)
class IntervalManager
{
var intervals:Array = new Array();
public function addInterval(p_id:String, p_timeLine:Object, p_functionName:String, p_interval:Number):Void
{
var myArgs:Array = arguments;
myArgs.shift();
var myInterval:Number = setInterval.apply(null, arguments);
intervals.push({interval:myInterval, id:p_id, args:myArgs});
}
public function removeInterval(p_id:String):Void
{
for(var i in intervals)
{
if(intervals[i].id == p_id)
{
clearInterval(intervals[i].interval);
intervals.splice(i, 1);
break;
}
}
}
public function pauseIntervals():Void
{
for(var i in intervals)
{
clearInterval(intervals[i].interval);
}
}
public function removeAllIntervals():Void
{
for(var i in intervals)
{
clearInterval(intervals[i].interval);
}
intervals = new Array();
}
public function unPauseIntervals():Void
{
for(var i in intervals)
{
intervals[i].interval = setInterval.apply(null, intervals[i].args);
}
}
public function unPauseSingleInterval(p_id:String)
{
for(var i in intervals)
{
if(intervals[i].id == p_id)
{
intervals[i].interval = setInterval.apply(null, intervals[i].args);
break;
}
}
}
public function pauseSingleInterval(p_id:String)
{
for(var i in intervals)
{
if(intervals[i] == p_id)
{
clearInterval(intervals[i].interval);
break;
}
}
}
}
Red Hat's Rough Recovery From CFO Exit
Windows Live Finds a New, Pre-installed Home
|