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.
You might also like
| Flash Optimization – Reusing Objects Flash optimization is becoming increasing important & with alternative development tools that developers... | Flash Optimization – Freeing Memory Flash optimization is becoming increasing important & with alternative development tools that developers... | 4 Free Useful icon Pack #1 : Creative Commons Attribution 3.0 License Downloads: #2: Creative Commons Attribution 3.0... | Deep Object Copies with ByteArray in AS3 Using the new ByteArray (flash.utils.ByteArray) class in ActionScript 3, you can now easily create deep object... |






