Skip navigation
Currently Being Moderated

Unable to get BitmapData.encode() to function - odd nonsensical compiler and runtime errors.

Jan 23, 2013 11:51 AM

Tags: #error #flex #actionscript #verifyerror #flashbuilder #bitmapdata #compiler #1065 #referenceerror #error_1065 #1014 #pngencoderoptions #jpgencoderoptions #error_1014

First... let me state that EVERY SINGLE STATEMENT REFERENCING THIS CLASS, ET. AL.,  is FULLY introspective when in the editor.   It will add the import statement if I haven't already added it.  It will autocomplete, etc.  Nothing is missing or misspelled, and the editor is fully aware that this class exists and how it is used. Doing a docs lookup on any of the terms (in the edit window) brings up the correct API reference in the help window.   It's only the compiler/runtime that complains, and usually, only the runtime.  I've cleaned and done every other little 'trick' I know of to overcome stupid errors that aren't errors.

 

Based on web searches for this type of error:

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

and

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

 

...I moved my actionscript code from the MXML component into an external class.  The only 'hint' I found from other contributors (and all on far older versions of the API) was that classes were not being declared public, so, even though I was using no class, but rather actionscript in a <fx:Script entity, I went ahead and created an external class.  To wit:

 

[actionscript]

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);

                    }

          }

}

[/actionscript]

 

This still provokes the following:

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

          at classes::PngEncoder()[D:\Dropbox\Work\PictureTools-OnTheMove\PictureT ools-OnTheMove-MakeIt\src\classes\PngEncoder.as:12]

          at components::ChoosePictureButton/choosePictureLightboxClosed()[D:\Drop box\Work\PictureTools-OnTheMove\PictureTools-OnTheMove-MakeIt\src\comp onents\ChoosePictureButton.mxml:165]

 

It makes no difference what import statements I use.

 

It makes no difference what form of reference I make, fully qualified "new flash.display.PNGEncoderOptions(..." or simply "new PNGEncoderOptions(..."

 

It makes no difference if I create a public or private or protected var of type PNGEncoderOptions.

 

It makes no difference if I instantiate and assign PNGEncoderOptions in the same statement where I declare the variable above the class, or if I instantiate it within the class constructor.

 

It makes no difference which boolean value I pass to the PNGEncoderOptions constructor when instantiating.

 

It makes no difference if I use the JPGEncoderOptions class instead.

 
Replies
  • Currently Being Moderated
    Jan 23, 2013 12:49 PM   in reply to Bramblethorne

    That class is new to Flash Player 11.3 according to the doc.  You will need to set your –swf-version appropriately.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 22, 2013 1:02 AM   in reply to Bramblethorne

    I suffered the same, apparently FlashDevelop seldom updates the "-swf-version" argument. I simply set it to "-swf-version=16" and it fixed everything.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points