2 Replies Latest reply on Mar 19, 2008 6:52 AM by Gene Godsey

    Non Constructor Runtime error

    Gene Godsey Level 1
      Here is the error:
      ----------------------
      TypeError: Error #1007: Instantiation attempted on a non-constructor.
      at BitmapButtonExample()[C:\programming\flex\__FlexProfessional\Chap16\BitmapButtonExample.a s:33]
      ---------------------

      Here is the code:
      ---------------------
      package{

      import flash.display.Bitmap;
      import flash.display.SimpleButton;
      import flash.display.Sprite;
      import flash.display.StageAlign;
      import flash.display.StageScaleMode;
      import flash.filters.ColorMatrixFilter;

      public class BitmapButtonExample extends Sprite{

      [Ebbed(source="assets/DSCF3515.jpg")]
      private var logoClass:Class;

      public function BitmapButtonExample(){
      if(stage != null){
      stage.scaleMode = StageScaleMode.NO_SCALE;
      stage.align = StageAlign.TOP_LEFT;
      }

      var myButton:SimpleButton = new SimpleButton();

      var filters:Array = new Array();
      var matrix:Array = new Array();
      matrix = matrix.concat([-1, 0, 0, 0, 256]); //red
      matrix = matrix.concat([0, -1, 0, 0, 256]); //green
      matrix = matrix.concat([0, 0, -1, 0, 256]); //blue
      matrix = matrix.concat([0, 0, 0, 0, 256]); //alpha

      var filter:ColorMatrixFilter = new ColorMatrixFilter(matrix);
      filters.push(filter);

      var myBitmap:Bitmap = new logoClass();

      var myBitmat2:Bitmap = new logoClass();
      myBitmat2.filters = filters;

      myButton.upState = myBitmap;
      myButton.overState = myBitmat2;
      myButton.downState = myBitmat2;
      myButton.useHandCursor = true;
      myButton.hitTestState = myBitmap;

      addChild(myButton);
      }

      }
      }
      ---------------------

      What is this?

      Thanks,
      Gene