Flex AS3 image Compression

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?
RenAndStimpyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gary BenadeCommented:
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

Regards
Gary
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RenAndStimpyAuthor Commented:
Yes thank you.

Adding this to the additional compiler arguments fixed the issue:
-swf-version=18
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Flex

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.