flash on 2009-3-20
Just a test application.
package
{
import flash.display.Sprite;
import flash.events.MouseEvent;
/**
* Just a test application.
*/
public class FlashTest extends Sprite
{
public function FlashTest()
{
var sp:Sprite = new Sprite();
sp.graphics.beginFill(0xFF0000, 1);
sp.graphics.drawRect(0, 0, 100, 100);
sp.graphics.endFill();
sp.x = (stage.stageWidth - sp.width) >> 1;
sp.y = (stage.stageHeight - sp.height) >> 1;
sp.buttonMode = true;
sp.addEventListener(MouseEvent.CLICK, onClick);
this.addChild(sp);
}
private function onClick(event:MouseEvent):void
{
var target:Sprite = event.currentTarget as Sprite;
if (target.scaleX < 0.2)
{
target.scaleX = 1;
target.scaleY = 1;
}
else
{
target.scaleX = target.scaleX * 0.5;
target.scaleY = target.scaleY * 0.5;
}
target.x = (stage.stageWidth - target.width) >> 1;
target.y = (stage.stageHeight - target.height) >> 1;
}
}
}