The Artist.as script will help you creating basic figures without needing to write the whole code. Just call any of it static functions and it will return you a sprite of the figure you asked. Note: This class doesn’t need an instance of Mono.as
Basics of Artist.as
In order to use Artist.as and get figures sprites, the only thing you will need to do is to call any of its static functions.
For example, imagine you want to add a black square into the stage from the Main.as. In order to do that, you will need to do the following:
stage.addChild(Artist.rectangle(0, 0, 100, 100, 0x000000, 1, 0, 0x000000, 1));
Just call the static function of artist called “rectangle”. It will ask you the x position, the y position, width, height, fill color, fill alpha, line thickness, line color and line alfa. Note that you will only need to give the position and size of the rectangle in order to use it. The rest of the options are optional.
Once you called this function, a sprite will be returned and you will be able, for example, to add it as a child to the stage.
Similar to this one, you can use any of the other functions inside of artist.
Public Static Functions
- rectangle(posX:int, posY:int, width:int, height:int, fillColor:int=0x000000, fillAlpha:Number=1, lineThickness:Number=0, lineColor:int=0x000000, lineAlpha:Number=1):Sprite
- roundedRectangle(posX:int, posY:int, width:int, height:int, radius:int, fillColor:int=0x000000, fillAlpha:Number=1):Sprite
- circle(posX:int, posY:int, radius:int, fillColor:int=0x000000, fillAlpha:Number=1, lineThickness:Number=0, lineColor:int=0x000000, lineAlpha:Number=1):Sprite
- ellipse(posX:int, posY:int, width:int, height:int, fillColor:int=0x000000, fillAlpha:Number=1, lineThickness:Number=0, lineColor:int=0x000000, lineAlpha:Number=1):Sprite
- line(xI:int, yI:int, xF:int, yF:int, lineThickness:Number=1, lineColor:int=0x000000, lineAlpha:Number=1):Sprite