RSS

Jagged Bitmap Movement

This entry was posted on Jun 05 2008

Recently I was working with floating text that had filters applied to it and couldn’t figure out why it was moving on whole pixels. It caused the slower movement to look really jagged and not smooth at all. It turns out that the cacheAsBitmap attribute when set to true (which is the case when filters are applied) causes flash player to render the DisplayObject on whole pixels only. A quick hack that seemed to work was to alter the width and/or the height of said DisplayObject on each frame. This causes flash player to constantly re-render and cache the bitmap data.

Example:

var myClip:MovieClip = new MovieClip();
addChild(myClip);
myClip.filters = [new BlurFilter(10,10,3)]

myClip.addEventListener(Event.ENTER_FRAME, update);

function update(e:Event) {
     e.target.width += Math.random()/100;
} 


One Response to “Jagged Bitmap Movement”

  1. Thank you for this post. You helped me solve my problem with my flash project. I could not get it to stop being jumpy.


Post a Comment