views:

26

answers:

1

The following code shows me that cacheasbitmap is turning on and off like it is suppose to but, I never get to see it visually like I did in AS2. Is this a error or a change in actionscript?

package {
import flash.display.Sprite;
import flash.events.MouseEvent;

public class Bitmapascache extends Sprite
{
    private var isOn:Boolean=false;
    private var box:mainBox;
    public function Bitmapascache()
    {
            box  = new mainBox()
            box.addEventListener(MouseEvent.MOUSE_DOWN,click);

            this.addChild(box);
    }

    public function click(e:MouseEvent):void
    {
        trace("click :"+box.cacheAsBitmap);
        if(isOn){
            box.cacheAsBitmap = false;
            isOn = false;
        }
        else{
            box.cacheAsBitmap = true;   
            isOn = true;
        }
    }
}

}

+1  A: 

taken from Livedocs:

After you set the cacheAsBitmap property to true, the rendering does not change, however the display object performs pixel snapping automatically. The animation speed can be significantly faster depending on the complexity of the vector content.

there is no visual change as such, even in as2 as far as i recall.

shortstick
Weirdly enough there is visible change in my AS2 code. Thanks for replying :)
Fahim Akhter