Flash CS3… 28 May 2008

Ok – so my movie has over 10,000 frames, got the following whilst trying to trim 2,000 frames from the end – My undo levels are set to the lowest possable value (happens to be 2, no idea why you cant disable them altogether), therefore I was supprised to see out of memory warning… This one is almost as strange (but not quite) as the Dreamweaver “no error occoured” error…

Flash Keycodes 24 July 2007

Click movie below to give it focus before testing a keycode.

I put this together to help testing cross broswer keyboard short-cuts, as the browser (particularly IE) tends to steal a lot of key press combinations.

Well just had one of those weekends when you go home, pull out an old machine and test your latest creation, only to find it runs a little slow… Made some simple tweaks to make sure that people who play the game on a slower machine can still play it fairly (i.e. so if time is a factor then to compensate for the slower machine). I then built in a calculation to test the efficiency of the game so I could potentially monitor my users experience of the game to get a sample of its efficiency.

This is when I noted at 25 frames per second, my setInterval (set at 40ms ,1000/25) was only being called 60% of the time. Switching to 50 frames per second had little of no impact on the efficiency either. This lead me to believe that setInterval did not run independently of the frame rate and that I should use onEnterFrame instead. The flash manual had this to say about setInterval -

If interval is less than the SWF file’s frame rate (for example, 10 frames per second [fps] is equal to 100 millisecond intervals), the interval function is called as close in time to the value of interval as possible. Executing long, memory-intensive scripts during an interval causes delays. If the function being called initiates a change to visual elements, you should use the updateAfterEvent() function to make sure that the screen refreshes often enough. If interval is greater than the SWF file’s frame rate, the interval function is called only after interval has expired and the playhead has entered the next frame; this minimizes the impact each time the screen is refreshed.

Therefore when updates are made on a small interval you should always use onEnterFrame and not setInterval – when we switched the same code to onEnterFrame the efficentcy jumped to 98%, even though the interval was matched to the frame rate the performance drop was considerable – I would even be a bold as to say unless your required interval is 10x the frame fate interval you should stick to onEnterFrame as the method instead.


September 2010
S M T W T F S
 1234
567891011
12131415161718
19202122232425
2627282930  
August 2010
S M T W T F S
1234567
891011121314
15161718192021
22232425262728
293031  
July 2010
S M T W T F S
 123
45678910
11121314151617
18192021222324
25262728293031
June 2010
S M T W T F S
 12345
6789101112
13141516171819
20212223242526
27282930  
powered by
wordpress
theme and icons by
web-engineer

©2008 web-engineer™
all rights reserved