TweenerTest
forked from Tweenerのテスト (diff: 12)
ActionScript3 source code
/**
* Copyright bradsedito ( http://wonderfl.net/user/bradsedito )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/mtPH
*/
package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.text.TextField;
import caurina.transitions.Tweener;
[SWF(frameRate=120)]
public class FlashTest extends Sprite {
private var txt:TextField;
private var _width:Number = 150;
private var _height:Number = 150;
public override function set width(val:Number):void{ _width = Math.max(val,150); draw(); }
public override function get width():Number{ return _width; }
public override function set height(val:Number):void{ _height = Math.max(val, 100); draw(); }
public override function get height():Number{ return _height; }
public function FlashTest() {
txt = addChild(new TextField) as TextField;
_width = stage.stageWidth-20;
draw();
txt.textColor = 0xFFFFFF;
txt.text = "...Touch me?";
txt.x = 20; txt.y = 12;
txt.width = 100;
txt.height = 30;
txt.selectable = false;
txt.addEventListener(MouseEvent.CLICK, click);
}
private function click(event:MouseEvent):void{
txt.removeEventListener(MouseEvent.CLICK, click);
Tweener.addTween(this, {height:height > 150 ? 150 : stage.stageHeight-30, time:0.6,
onComplete:function onComplete():void{
txt.addEventListener(MouseEvent.CLICK, click);
txt.text = "..Touch me?";
}});
}
public function draw():void{
txt.text = String("height = " +int(_height));
graphics.clear();
graphics.beginFill(0x232323, 0.85);
graphics.drawRect(10, 30, _width, _height);
graphics.moveTo(10, 30);
graphics.lineTo(10, 30);
graphics.lineTo(10, 10);
graphics.lineTo(110, 10);
graphics.lineTo(110, 30);
graphics.endFill();
}
}
}