Copy link to clipboard
Copied
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?
more likely it's your ram limit.
Copy link to clipboard
Copied
more likely it's your ram limit.
Copy link to clipboard
Copied
Far from it, it takes 1.8gb before the error is thrown, while I have 8gb.
Copy link to clipboard
Copied
do you have a 64 bit os and flash cc?
if not that's a ram limit.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
i'm talking about the reason you're seeing that error.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
That's what I'm trying to say, the problem is flash player trying to use too much memory...
Copy link to clipboard
Copied
ok
Copy link to clipboard
Copied
The problem was not solved but I approached what I was trying to do differently...
Thanks anyway...
Copy link to clipboard
Copied
you're welcome.
Copy link to clipboard
Copied
How did you solved it? I'm stucked!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now