|
-
Senior Member
setInterval Q
Code:
setInterval(this, "Main", 25);
function Main() {
Bug._x += 1;
updateAfterEvent();
}
My frame rate is "1", but to me that should run every 25 ms (Aproximatly as fast as a SWF at 40 FPS), and the updateAfterEvent should display is every time is run (Not after each frame). So why is it that if i set the frame rate higher "Bug" seems to get a boost of speed?
This experiment has no practicle reason, just for a learning experiance and maby for aid in some other useless experiments.
92.7 Fresh FM for all your South Aussies - Doof Doof music FTW people!
-
Senior Member
I suggest you do a quick check to see if Main() is being invoked 40 times like you think it is. I bet it's not There are some very odd things happening under the covers with framerate. We have seen issues with events not triggering as often as they should once a certain number per frame has been reached and I wonder if this is something like that.
Geek guess: there is some event thread under the covers that is prevented from starving the main thread. Too much load on that thread and it gets it's priority lowered a bit to keep the frame rate up. That's how streaming audio is treated if you don't tell it to sync. This is a COMPLETE guess pulled from someplace stinky but it does fit the behavior we have seen with XMLSocket onData();
-
Senior Member
Oh ok fair enough, thanks for the reply. Supose ill just use the normal onEnterFrame.
92.7 Fresh FM for all your South Aussies - Doof Doof music FTW people!
-
Senior Member
does your code frame have a stop() in it? Maybe it's executing over and over.
-
Senior Member
What do you mean? Why would i need one? Ill have a try.
92.7 Fresh FM for all your South Aussies - Doof Doof music FTW people!
-
Senior Member
That stop thing didnt do anything else but i had an idea, i created a varible to go up every time the main function was run threw setInterval, and i recorded how many times it ran every second.
I had it set to run every 20 mill's (about 40 FPS) and it only ran about 8 times every second, but i left the computer for about 1 min and came back and it was running 28 time a second, and was slowly increasing. This very stange, would any of you know why it starts of realy slow?
92.7 Fresh FM for all your South Aussies - Doof Doof music FTW people!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|