Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

BitmapData Limit

New Here ,
Dec 06, 2013 Dec 06, 2013

Hi,

I'm getting a flash error when creating many BitmapDatas (I'm not talking about one bitmap that is too big).

I created for you a copy-paste class that reproduces the error.

Simply create an Issue class file and copy paste that code, then instantiate that class in your main class (new Issue()).

package

{

          import flash.display.Bitmap;

          import flash.display.BitmapData;

          import flash.display.MovieClip;

          import flash.events.Event;

          public class Issue extends MovieClip

          {

                    private var mc:MovieClip;

                    public function Issue():void

                    {

                              addEventListener(Event.ENTER_FRAME, eachFrame);

                              mc = new MovieClip();

                    }

                    private function eachFrame(e:Event):void

                    {

                              for (var i:uint = 0; i < 100; i++)

                              {

                                        createBitmap();

                              }

                    }

                    private function createBitmap():void

                    {

                              var bm:Bitmap = getBitmap();

                              mc.addChild(bm);

                    }

                    private function getBitmap():Bitmap

                    {

                              var bmd:BitmapData = new BitmapData(500, 500);

                              return new Bitmap(bmd);

                    }

          }

}

The error I'm getting:

ArgumentError: Error #2015: Invalid BitmapData.

at flash.display::BitmapData/ctor()

at flash.display::BitmapData()

Something I noticed is when reducing the bitmap size flash will produce more bitmaps before throwing the error.

When multiplying:

Bitmaps Created before error was thrown x each BitampData size (example BitmapData size: 500x500), the overall amount of pixels generated before the error was thrown is very similar: more than 400000000.

Amount of bitmaps generated before the error was thrown, in bulks of 100:

1600: 500x500

2600: 400x400

4800: 300x300

Creating in smaller bulks will lead to more accurate numbers, but I think I'm onto something here - deliberate flash limit?

TOPICS
ActionScript
2.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 06, 2013 Dec 06, 2013

more likely it's your ram limit.

Translate
Community Expert ,
Dec 06, 2013 Dec 06, 2013

more likely it's your ram limit.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 06, 2013 Dec 06, 2013

Far from it, it takes 1.8gb before the error is thrown, while I have 8gb.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 06, 2013 Dec 06, 2013

do you have a 64 bit os and flash cc?

if not that's a ram limit.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 06, 2013 Dec 06, 2013

64 bit os - yes

flash cc - will it really help me? even though the software itself is 64 bit, flash player remains 32 bit (correct me if I'm wrong), and the problem occurs in the flash player.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 06, 2013 Dec 06, 2013

the problem is you're publishing with a 32 bit program (if you're not using flash cc) and so you have a 2gb limit to the ram used when publishing.

if you used flash cc on a 64bit system, you would be able to use all your ram to publish your app.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 06, 2013 Dec 06, 2013

Are you talking about the actual publishing process or about running the swf in the flash player?

I need people who run the swf from other computers to be able to experience the same 64 bit limit in the flash player, which I'm not sure is what you mean, and I don't really understand how it's possible to run flash player with a 64 bit limit. (not the actual publishing process, but running the swf in the flash player itself)

Sorry if I got you wrong and I'm rephrasing myself for nothing, it just sounds like you're talking about something else entirely.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 06, 2013 Dec 06, 2013

i'm talking about the reason you're seeing that error.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 06, 2013 Dec 06, 2013

Okay, so please elaborate.

How will exporting the swf in cc result in running the swf in 64 bit if the flash player itself is 32 bit?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 06, 2013 Dec 06, 2013

i've said nothing about flash player, so far.

i'm merely answering your query about why you're seeing a publish limit.

however, adobe does make 64 bit flash players both for stand-alone and browser plug-in.  but those can't be used with a 32 bit os.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 06, 2013 Dec 06, 2013

I don't think what I'm seeing is a publish limit...? It's a flash player limit to the best of my understanding.

About the second thing you said, I understand, but I can't count on such a thing which many users worldwide won't have.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 06, 2013 Dec 06, 2013

if you see no problem when publishing and only when testing, it's not flash pro trying to use too much memory, it is the flash player that needs to access more memory.

if you see a problem when publishing, it's flash pro that needs to access more memory.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 07, 2013 Dec 07, 2013

That's what I'm trying to say, the problem is flash player trying to use too much memory...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 07, 2013 Dec 07, 2013

ok

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 07, 2013 Dec 07, 2013

The problem was not solved but I approached what I was trying to do differently...

Thanks anyway...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 07, 2013 Dec 07, 2013

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 26, 2018 Apr 26, 2018
LATEST

How did you solved it? I'm stucked!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines