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();
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();
This entry was posted
on Saturday, November 21st, 2009 at 12:26 am and is filed under ActionScript, Tutorials.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.



