topical media & game development
#graphic-flex-image-effects-01-Flex-ShapesMadeEasy.ax
#graphic-flex-image-effects-01-Flex-ShapesMadeEasy.ax
[swf]
[flash]
flex
package {
import flash.display.Sprite;
[SWF(width=550, height=400, backgroundColor=0xFFFFFF)]
Demonstrates the drawing of basic shapes using the drawing API.
public class @ax-graphic-flex-image-effects-01-Flex-ShapesMadeEasy extends Sprite {
Constructor.
public function @ax-graphic-flex-image-effects-01-Flex-ShapesMadeEasy() {
draw();
}
Draws rectangle and oval shapes through built-in drawing API methods.
private function draw():void {
var halfWidth:Number = stage.stageWidth/2;
var halfHeight:Number = stage.stageHeight/2;
var quarterWidth:Number = halfWidth/2;
var quarterHeight:Number = halfHeight/2;
graphics.beginFill(0xFF0000);
graphics.drawCircle(quarterWidth, quarterHeight, Math.min(quarterWidth, quarterHeight));
graphics.endFill();
graphics.beginFill(0x0000FF);
graphics.drawEllipse(halfWidth, 0, halfWidth, halfHeight);
graphics.endFill();
graphics.beginFill(0x00FF00);
graphics.drawRect(0, halfHeight, halfWidth, halfHeight);
graphics.endFill();
graphics.beginFill(0xFF00FF);
graphics.drawRoundRect(halfWidth, halfHeight, halfWidth, halfHeight, 70, 70);
graphics.endFill();
}
}
}
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.