Tag Archives: flash bitmapdata tutorials

Sample BitmapData and Images

In AS3, you must give objects in the library class association in order to instantiate them with AS. If you don’t have a class for your bitmap (ie you don’t need to extends BitmapData with more methods) then you can type in a class name and Flash will automatically create one for you which will extend BitmapData. Than you just call that classes constructor, assign the instance to a variable and tile it:

import flash.display.BitmapData;
var tile:BitmapData = new MyImage();
this.graphics.beginBitmapFill(tile);
this.graphics.lineTo(this.stage.stageWidth, 0);
this.graphics.lineTo(this.stage.stageWidth, this.stage.stageHeight);
this.graphics.lineTo(0, this.stage.stageHeight);
this.graphics.lineTo(0, 0);
this.graphics.endFill();