1 Reply Latest reply on May 20, 2007 6:48 PM by BuffDogg

    Embedding Images in a Document Class

      I cannot figure out why this error keeps getting thrown. I've tried everything I've known and I'm sure it's a simple solution. I've created a class that has embedded assets and I keep getting the following error at runtime.

      TypeError: Error #1007: Instantiation attempted on a non-constructor.
      at test$iinit()

      My fla file is an empty file with test.as as it's Document class and has the 2 images I'm trying to embed in the library with the classes on them identical to whats in the as file.

      The test.as file looks like this.

      import flash.display.Bitmap;
      import flash.display.BitmapData;
      import flash.display.Sprite;
      import flash.events.Event;
      import flash.utils.Timer;
      import flash.events.TimerEvent;
      import flash.filters.BlurFilter;
      import flash.geom.Point;
      import flash.geom.ColorTransform;
      import flash.display.BlendMode;
      import flash.events.MouseEvent;

      public class test extends Sprite
      [Embed(source='flash.png' )] private const myImage: Class;
      [Embed(source='pattern.gif' )] private const Pattern: Class;

      private const imageData: BitmapData = Bitmap( new myImage() ).bitmapData;

      private var mouseDown: Boolean;

      public function Main()
      graphics.beginBitmapFill( Bitmap( new Pattern() ).bitmapData );
      graphics.drawRect( 0, 0, 256, 256 );