Embedding Images in a Document Class


i cannot figure out why error keeps getting thrown. i've tried i've known , i'm sure it's simple solution. i've created class has embedded assets , keep getting following error @ runtime.

typeerror: error #1007: instantiation attempted on non-constructor.
@ test$iinit()

my fla file empty file test.as it's document class , has 2 images i'm trying embed in library classes on them identical whats in file.

the test.as file looks this.

package
{
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 );
graphics.endfill();
}
}
}

quick correction.....the public function main should "public function test"


More discussions in Flex (Read Only)


adobe

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums