Код AS3:
import flash.display.Sprite;
import flash.events.Event;
var s:Sprite = new Sprite();
s.graphics.beginFill( 0 );
s.graphics.drawRect( -100, -100, 200, 200 );
s.x = s.y = 250;
this.addChild( s );
s.addEventListener( "RESIZE", SpriteResize );
stage.addEventListener( MouseEvent.CLICK, Click );
function SpriteResize( e:Event ):void {
trace( e.type, s.width );
}
function Click( e:MouseEvent ):void {
s.width = 200 * ( Math.sin( getTimer() / 1000 ) + 1 );
s.dispatchEvent( new Event( "RESIZE" ) );
}