package {
import flash.display.Sprite;
[SWF(width=550, height=400)]
public class Main extends Sprite {
public function Main() {
var square:Square = new Square();
addChild(square);
// Move to (300,300)
square.x = 30;
square.y = 30;
// Stretch horizontally and squash vertically
square.scaleX = 2;
square.scaleY = 0.5;
// Make 50% alpha
square.alpha = 0.5;
// Rotate 45 degrees
square.rotation = 45;
}
}
}
class Square extends flash.display.Sprite {
public function Square() {
graphics.lineStyle(5);
graphics.beginFill(0xFF);
graphics.drawRect(0, 0, 100, 100);
graphics.endFill();
}
}
|