Flex AS3 image Compression

Posted on 2014-07-15
Last Modified: 2014-07-16
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?
Question by:RenAndStimpy
    LVL 19

    Accepted Solution

    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="">

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


    Author Comment

    Yes thank you.

    Adding this to the additional compiler arguments fixed the issue:

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Ever wondered how to display how many visitors you have online. In this tutorial I will show you an easy but effective way to display the number of online visitors in WhizBase. In this article I assume you have read my previous articles and know …
    Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
    Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now