Skip to main content
March 11, 2010
Answered

question regarding cacheAsBitmap and pixelSnapping of Display Objects

  • March 11, 2010
  • 1 reply
  • 572 views

In my flash file, I essentially have a container movieclip that holds all the content for the site.  This container then always positions itself in the center of the stage.  I am not exactly keen on the fact that the edges of the content, depending on the stage dimensions, sometimes look blurry because the content is not snapping to the nearest pixel.

Well, I looked into cacheAsBitmap and am still slightly confused.  Is the only way to enable pixelsnapping for a display object (such as a movieclip) come from using cacheAsBitmap?

And if it is, should I even consider using it on the container?  By no means is there a lot of complex vector artwork, so would I be hurting performance if I used it?  Caching a bitmap representation for my entire site just seems pretty memory intensive.  Am I way off base?  Is there somewhere else I should be looking?

This topic has been closed for replies.
Correct answer

If things look blurry on edges, it's your positioning code... Use Math.floor or round or ceil in order to position on whole pixels:

95 / 2 = 47.5

Math.floor( 95 / 2 ) = 47

1 reply

Correct answer
March 11, 2010

If things look blurry on edges, it's your positioning code... Use Math.floor or round or ceil in order to position on whole pixels:

95 / 2 = 47.5

Math.floor( 95 / 2 ) = 47

March 11, 2010

That was quite a "duh" moment you created for me.  Works perfectly.  Thanks.