Flex AS3 image Compression

RenAndStimpy used Ask the Experts™
I'm trying to compress BitmapData using the following:
myBitMapData.encode(new Rectangle(0,0,640,480), new JPEGEncoderOptions(80), byteArray);

Open in new window

I have imported the class using:
import flash.display.JPEGEncoderOptions;

Open in new window

But no matter what I try i keep getting the following error at runtime:
ReferenceError: Error #1065: Variable flash.display::JPEGEncoderOptions is not defined.

Any suggestions?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Since this error is occurring at runtime and not compile time the culprit is most likely your flash player version

JPEGEncoderOptions was introduced in Flash Player 11.3, so make sure your project is compiling with the  correct minimum SDK settings. You should be using at least Flex 4.6 SDK

It's worth checking your project XML namespace:
<application xmlns="http://ns.adobe.com/air/application/3.5">

If you are using a loader like SWFObject, make sure it is set to the correct flash player settings too



Yes thank you.

Adding this to the additional compiler arguments fixed the issue:

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial