Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > General > Best Practices

Reply
 
Thread Tools Rate Thread Display Modes
Old 05-12-2008, 06:45 PM   #1
maskedMan
Obfuscated Coder
 
maskedMan's Avatar
 
Join Date: Apr 2008
Posts: 681
Default Best Uses for cacheAsBitmap (as2)

I'm aware that it is probably a good idea to use cacheAsBitmap when you are dealing with complex vector objects that seldom need to change shape/scale/color (in my case, I'm dealing with a map of the US where each state is its own vector object and they only ever change color when the user requests a new data set). But there are a few other instances where I might be able to use cacheAsBitmap but am not sure whether doing so will actually help me.

For example, I have a legend consisting of a fairly simple gradient bar and several bits of text. Now, the gradient box is of course only four vector points but the fill is a gradient. Would it make sense to turn on cacheAsBitmap for this gradient bar? Does the mathematical computation required to generate the gradient cost more processing power than storing the image as a bitmap?

But let's go a step further... what if the gradient bar legend is inside a movie clip that also contains a background and some text data that only changes in the event that the user selects a new data set? Would I then be able to turn on cache as bitmap for the whole clip?

Last edited by maskedMan; 05-12-2008 at 06:49 PM..
maskedMan is offline   Reply With Quote
Old 06-15-2008, 06:52 AM   #2
hexvector
Registered User
 
Join Date: Jun 2008
Location: Arizona
Posts: 1
Default

Yes, for complex vector data that *does not* scale or rotate it is good to cache it. Text is vector as well and is fairly slow to move or animate if not cached due to its complexity.

You will good to cache the entire container sprite. Even if it has text inside of it that is selectable it can help. Since you can't set cacheAsBitmap on a textField it is common to put it in a sprite and turn on caching.

It does require memory though to process the vector into a bitmap and store it. But initial performance cost and memory is negible if your sprite is small.
hexvector is offline   Reply With Quote
Old 06-24-2008, 05:03 PM   #3
Sly Raskal
L'eggo my Lego
 
Sly Raskal's Avatar
 
Join Date: Aug 2006
Posts: 10
Default

Does setting a MovieClip's cacheAsBitmap property to true and adjusting the MovieClips alpha values a detriment?

Are scale and rotation the only two characteristics that are detrimental to using cacheAsBitmap?
Sly Raskal is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Clicks don't work in loaded AS2 movie tropicaltalent ActionScript 3.0 3 05-02-2008 02:23 AM
FLV in external AS2 SWF not showing up when loaded to AS3 swf pcmxa ActionScript 3.0 0 04-10-2008 10:21 PM
Loading AS2 .swf files Izend ActionScript 3.0 0 02-26-2008 11:59 PM
AS2 email script:: SWF loader for AS3 file into AS2 container Loksim ActionScript 2.0 5 02-12-2008 05:45 PM
AS3 loads AS2 swf. AS2 swf not displayed darbar ActionScript 3.0 0 07-20-2007 10:12 PM


All times are GMT. The time now is 01:21 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.