I am trying to let the user import giant images into a flash application.
Unfortunately the BitmapData object's dimensions cannot exceed "8,191 pixels in width or height, and the total number of pixels cannot exceed 16,777,215 pixels" (see Reference)
Obviously with FlashPlayer11 these limitations vanish - BUT: As I only get bytes from the FileReference, I need to convert these via Loader.loadBytes(), to get access to the image data. This doesn't seem to work for images exceeding the old BitmapData limitations.
Does anybody have an idea, what causes this problem / how to work-around?
function onAddButtonClicked(e:MouseEvent = null):void {
trace("Opening file");
_frl = new FileReferenceList();
_frl.addEventListener(Event.SELECT, onFilesSelected);
_frl.browse([new FileFilter("Images (*.jpg, *.jpeg, *.gif, *.png)", "*.jpg;*.jpeg;*.gif;*.png")]);
}
//When user has selected the files
function onFilesSelected(e:Event):void {
for each (var item:FileReference in _frl.fileList) {
item.load();
item.addEventListener(Event.COMPLETE, onFileLoaded);
}
}
//When files are loaded into the application
function onFileLoaded(e:Event):void {
trace("File Loaded!");
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onBytesLoaded);
loader.loadBytes(e.target.data);
}
//When files are finally available as Loader/Image
function onBytesLoaded(e:Event):void {
addChild((e.target as LoaderInfo).loader);
}