Skip to main content
This topic has been closed for replies.
Correct answer jrunrandy

It's there. drawWithQuality is new in Flash Player 11.3, AIR 3.3, so make sure that your ActionScript Reference filter settings are for 11.3 / 3.3 or higher.

HTH,

Randy Nielsen

Senior Content and Community Manager

Adobe

3 replies

Participant
May 8, 2013

i have a big jpeg image file, which dimension is 19000*14000, the file size is about 41M. i'm using air 3.3 sdk, but after load complete i can't see the image on stage. please help!!!

here is my code;

protected function button1_clickHandler(event:MouseEvent):void

{

file = new File();

file.addEventListener(Event.SELECT, imageFileHandler);

file.browseForOpen("image file", [new FileFilter("image file",".jpg;.jpeg")]);

}

protected function imageFileHandler(event:Event):void

{

fs = new FileStream();

fs.openAsync(file, FileMode.READ);

fs.addEventListener(Event.COMPLETE, bytesComplete);

}

protected function bytesComplete(event:Event):void

{

loader = new Loader();

loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoadHandler);

var bytes:ByteArray = new ByteArray();

fs.readBytes(bytes);

loader.loadBytes(bytes);

fs.close();

}

protected function imageLoadHandler(event:Event):void

{

image.source = (loader.content as Bitmap).bitmapData;

kglad
Community Expert
Community Expert
May 8, 2013

In  AIR 1.5 and Flash Player 10, the maximum size for a BitmapData object is 8,191 pixels in width or height, and the total number of pixels cannot exceed 16,777,215 pixels. (So, if a BitmapData object is 8,191 pixels wide, it can only be 2,048 pixels high.) In Flash Player 9 and earlier and AIR 1.1 and earlier, the limitation is 2,880 pixels in height and 2,880 in width.

Starting with AIR 3 and Flash player 11, the size limits for a BitmapData object have been removed. The maximum size of a bitmap is now dependent on the operating system.

Participant
May 8, 2013

Thanks for your answer, kglad. i knew all this. I use neither AIR 1.5, nor AIR 1.1, but AIR 3.3! And it just display nothing, whithout errors!!

OS info:

Win 7 ultimate, 2G RAM, Intel Core Duo 1.66Ghz, 667MHz FSB, 2M L2 Cache,

Intel GMA 950.

January 23, 2013

I don't believe the .encode() method functions.

I'm afraid that nothing I do can get the given example to work, using either the jpg encoder or the png encoder, whether in an <fx:Script entity, or in an external class. Always it gives one of the two following errors (based on where and how I instantiate the encoder options object)

ReferenceError: Error #1065: Variable flash.display::PNGEncoderOptions is not defined.

and

VerifyError: Error #1014: Class flash.display::PNGEncoderOptions could not be found.

/* more verbosely */

ReferenceError: Error #1065: Variable flash.display::PNGEncoderOptions is not defined.

at classes::PngEncoder()

at components::ChoosePictureButton/choosePictureLightboxClosed()

Here's the class I'm currently using, though it represents only one iterative attempt of dozens and dozens.

package classes

{

import flash.display.BitmapData;

import flash.display.PNGEncoderOptions;

import flash.geom.Rectangle;

import flash.utils.ByteArray;

public class PngEncoder

{

public function PngEncoder(bmpData:BitmapData, png:ByteArray, fast:Boolean)

{

bmpData.encode(new Rectangle(0, 0, bmpData.width, bmpData.height), new flash.display.PNGEncoderOptions(fast), png);

}

}

}

kglad
Community Expert
Community Expert
January 23, 2013
January 23, 2013

Thank you, but I've already been using that for a while and it's not feasible.  The synchronous executing thread will freeze a iOS application for fully a minute and a half to encode a 1024x768 image, even at 100% (least processing required) quality. It does nearly as badly for a 320x240 thumbnail.

I'm wishing to use the internal API -as it's written-, not an extraneous workaround.... and do so in the hope that it will be a better alternative to this untenable problem.

Sidenote: I believe that the article is incorrect as to resulting filesize. Depending on quality of JPEG encoding, an encoded JPEG is nearly universally smaller than the lossless PNG, unless I'm missing something.

I was hoping that by using PNG, which is less processor intensive to encode/decode, that I might get an additional performance boost, while preserving quality... at the cost of a larger filesize of course.

If anyone has had success using the encode method and the two (well, 3) encoder options classes, please let me know how you did it.

(dev env Flashbuilder 4.7, SDK Flex 4.6.0 (build 23201), AIR SDK 3.5.  Target device Apple iPad 2)

Participant
September 12, 2012

drawWithQuality() is mentioned under draw() but is not documented itself.

jrunrandy
Adobe Employee
jrunrandyCorrect answer
Adobe Employee
September 13, 2012

It's there. drawWithQuality is new in Flash Player 11.3, AIR 3.3, so make sure that your ActionScript Reference filter settings are for 11.3 / 3.3 or higher.

HTH,

Randy Nielsen

Senior Content and Community Manager

Adobe

Participant
September 14, 2012

Ah! I see. You're right, I hadn't realized how the filters work. Thanks.