# How to eliminate screen jitter in Flash game?

We made a flash game with a big screen size(1000x600), and the terrain graphic will jitter while the screen scrolling(that's, camera moving with player) continuously.

What's the root cause? Or if you know how to eliminate this problem, please tell me. Any help is appreciated.

UPDATE:

The map's size is more bigger than screen, e.g 6000x1200. And the map has more than one layer, generally it has 3 layers. Terrain is composed by tiles. And FPS is 24.

If the FPS is set to 60, things will be better. But any way, it should work well at 24 FPS. I'm not sure if it is a natural problem of flash player, because some times a terrain object(e.g a house) look like a little bit distorted.

• You need to add some more information here. How do you scroll the terrain? Are you testing the release build? Is your terrain tiled in any way? How many FPS do you get? – bummzack May 17 '11 at 9:51
• Just a guess, but maybe you have too much being rendered at once. Don't render anything that isn't in the camera, and see if that helps. – thedaian May 17 '11 at 15:07
• 24FPS looks smooth in film, but anything below 30FPS is unlikely to look smooth for gaming. I'm not sure if that's what's causing your jitter problem, but you should look at increasing the framerate to at least 30, if you can. – Mitch Lindgren May 17 '11 at 15:33
• Can you post the swf in question? I know a lot of things that could fix a bunch of different jittering problems. – AttackingHobo May 17 '11 at 16:11
• Lets do the math to find a good framerate. By "good" I mean a framerate that converts into a nice round milliseconds between each frame. 60fps = 16.6... 30fps = 33.3... 25fps = 40 24fps = 41.6... So from this, it looks like 25 makes the most sense. – Adam Harte May 17 '11 at 21:25

Depending of the kind of Jitter you are getting, this could be the large images snapping to pixels when they move. This will be most noticeable when it is moving slowly.

Try turning smoothing on for your bitmaps, and/or turn cache and bitmap on.

Thanks for your answers, I just find some articles related to this problem :

This sounds like a VSYNC issue.

https://stackoverflow.com/questions/989471/vsync-in-flex-flash-as3

This may also be worth a browse, but without more details it's really not possible to provide better information.

http://www.craftymind.com/2008/04/18/updated-elastic-racetrack-for-flash-9-and-avm2/

The thread is a little old but I decided to post my answer anyway.

A strange effect that solved my main jitter issues: Make sure you set your animated MovieClips content to even pixel coordinates!

In my case it was a simple centering that caused major jittering issues:

var bitmap:Bitmap = new Bitmap();
bitmap.bitmapData = bitmapData;
bitmap.smoothing = true;
bitmap.x = -(bitmap.width/2);
bitmap.y = -(bitmap.height/2);

bitmap.x = -int(bitmap.width/2);