Skip to main content
Inspiring
January 31, 2012
Question

Air for Android 4.0 cacheAsBitmap Issue

  • January 31, 2012
  • 3 replies
  • 1140 views

Problem Description:

The frame rate of my app drops dramatically if I use:

cacheAsBitmapMatrix or cacheAsBitmap

or if I add a child of a sprite instance which are already cached are added to the displayList.

This behavior only takes place in Android 4.0 GALAXY NEXUS

The App runs on slower devices: Galaxy 2S Android 2.3 and iPhone 4 super smooth (iOS 5)

Is this a known issue with the new operation system ICS 4.0

This topic has been closed for replies.

3 replies

Inspiring
February 3, 2012

Unfortunatelly I didn´t get any answer from Adobe so I don´t know if this is a bug or a feature!

Here is my workaround code! In my case that works just perfect. Of course if I want to do any transitions to my button I have to do it with matrixes and not only with width or height property.

 

private function myCacheAsBitmap() : void

                    {

       if ( bttnWidth > 0 && bttnHeight > 0 )

                                   {

            buttonBitmapData = new BitmapData ( bttnWidth, bttnHeight, true, 0x00000000 );

            buttonBitmap = new Bitmap ( buttonBitmapData );

 

            var scaleMatrix : Matrix;

 

            scaleMatrix = new Matrix (1, 0, 0, 1, 0, 0);

 

            buttonBitmapData.draw ( this, scaleMatrix, null, null, null, true);

 

            addChild ( buttonBitmap );

 

           removeChild ( offStateBackground );

           removeChild ( onStateBackground );

           removeChild ( buttonText );

 

           if ( pictureLoaded == true)

                 removeChild ( iconBitmap );

                              }

}

Participating Frequently
February 3, 2012

Any word on if this will be fixed in AIR 3.2?

February 1, 2012

I have the same problem!

I hope we hear from Adobe soon!

Inspiring
February 2, 2012

I found a workaround for the problem.

I am writing all needed data by hand in a bitmap and remove the original childs from the display list.

In my case it works fine! And now I´ve got my 60 fps back

But I think the original cacheAsBitmap should work as fast as this solution!