PDA

View Full Version : Too many bitmaps?



dmennenoh
January 18th, 2010, 04:38 PM
I've been working on a simple mosaic generator for a project and have been crashing Flash consistently by trying to add too many bitmaps to a Sprite. I can crash Flash every time with the following:

for(var i:int = 0; i < 10000; i++){
var d:BitmapData = new BitmapData(20,20);
addChild(new Bitmap(d));
}

I get a 2015 error - invalid BitmapData.

9000 works without issue... 10000 crashes. Problem is I need 10000.

Is this a known limitation? I could try using multiple sprites and adding say 5000 to each, but that wouldn't be easy with this project. But if I have to I have to...

mathew.er
January 18th, 2010, 05:35 PM
Anything that needs to add 10000 bitmaps as children is just wrong. Try to figure out another way to do it.

dmennenoh
January 18th, 2010, 05:43 PM
Anything that needs to add 10000 bitmaps as children is just wrong. Try to figure out another way to do it.


That is not a good answer.

It works fine with 9000 bitmaps, but like I said, I need 10000 - or more. The other way to do it is to compose them into one bitmap - but that will not work for what I am doing because a single bitmap is not high enough resolution. I have 10,000 (or more) small 'tiles' coming from a server - images of people - those need to be tinted and then combined to form a single mosaic image. The real problem - why I can't make one single bitmap - is that I need to be able to zoom in and see the individual tiles.

So if you have anything better than 'figure out another way' I'd be glad to hear it.

dmennenoh
January 18th, 2010, 05:58 PM
Hmmm... thinking about the single bitmap a bit more. I may be able to get away with that actually. We were going to go with 50x50 tiles, but if I did 30x30 a 3000x3000 image would hold all 10000 tiles. I may not have another choice.

snickelfritz
January 18th, 2010, 06:52 PM
I believe there is limit of ~2800 pixels for a bitmap in Flash.

dmennenoh
January 19th, 2010, 10:01 AM
I believe there is limit of ~2800 pixels for a bitmap in Flash.

In older version of Flash yes. Not any more...

dmennenoh
January 19th, 2010, 11:09 AM
Sweet. Using a 4000 x 3000 image I can fit 10,000 40x30 tiles... draws all 10,000 with tinting in about 20 seconds which is quite acceptable.