Invalid BitmapData error - WHY?!?!
Sorry for multiple postage but I need this issue clearing up.
To recreate my issue, create a document class with this code:
Code:
package {
//
import flash.display.Sprite
import flash.display.BitmapData;
//
public class main extends Sprite {
//
var allData:Array = new Array();
//
public function main() {
var n:int;
for (n=0;n<9000;n++) {
var colour:int = Math.round(Math.random()*0xFFFFFF);
var myBD:BitmapData = new BitmapData(2, 2, false, colour);
allData[n] = myBD;
}
}
}
}
This works fine and creates 9000 BitmapData objects.
However, if you change the loop size to 10000(BEWARE - THIS MAY CRASH FLASH ENTIRELY), you will get an Invalid BitmapData error and sometimes (for me anyway) Flash will continually display dialog boxes the content of which I cannot actually see (might be a Vista thing) or just irrevocably crash.
Note:all of the code is important - if you comment out the line which assigns the data to the array everything seems to work fine. I've never been more confused...
Anyone got any ideas?