Creating a Killer Flash Site - Update 7: Bitmap Caching
Published May 19th, 2007 in: ActionScript 3, Flash
Using cacheAsBitmap we can get much faster screenanimation, which is important for creating smooth scrolling etc. Large textareas was a nightmare to deal with in the pre 'Flash Player 8' days, especially on MacOS. With cacheAsBitmap this is no longer a problem.
ActionScript:
// container with a textField that we want to cache ///
stageContainer.mainTextArea.htmlText = "text text text";
stageContainer.cacheAsBitmap = true;
However, I've discovered a small issue, where the cacheAsBitmap function make different results on Windows and MacOS, and that is when making a bitmap of htmlText using non-embedded fonts. On windows the fonts looses the aliasing, and becomes pixel clear, but on Mac they keep the aliasing. If you embed the fonts - they appear aliased on both systems. Strange?!
In this application, I didn't want to use embedded fonts (to keep it as small as possible), so I needed to find a solution. Luckily Windows systems don't seem to have the same problem with large textareas, so my solution (for now) was to only use bitmap cache on Mac. On the end of my stageBuilder function I insert a small systemcheck. If it is a Mac, we make a bitmap cache.
ActionScript:
// container with a textField that we want to cache ///
// but only if Mac OS ///
stageContainer.mainTextArea.htmlText = "text text text";
if (Capabilities.os.substr(0,3) == "Mac") {
stageContainer.cacheAsBitmap = true;
}
About
You are currently browsing the Øystein Wika weblog.
Blog Feed
Recent Posts
- The perfect 40th Birthday Gift
- onAIR tour Europe
- Flex/AIR Pre-Release Tour: Oslo
- Papervision3D Test
- Designing Wika Media
- Flash on the Beach '07
- Linpro wins NUUG Award
- SWFMouseWheel (alpha)
- Flash Player gets H.264 support
- Flash Business Logic
- Oslo Flash Platform User Group
- AIR Chat - Live from Dallas
- I got Pownce Invites
- Adobe onAIR Bus Tour Summer '07
- New Project: CTRL7.com