forked from: forked from: testtest

by yasai forked from forked from: testtest (diff: 34)
♥0 | Line 36 | Modified 2009-05-19 22:07:00 | MIT License
play

ActionScript3 source code

/**
 * Copyright yasai ( http://wonderfl.net/user/yasai )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/r2gZ
 */

// forked from yasai's forked from: testtest
// forked from Nicol's testtest
package {
    import flash.display.*;
    import flash.text.*;
    import flash.events.*;
    import caurina.transitions.Tweener;
    
    public class TEST extends Sprite{
        public function TEST(){
            //宣言
            var tf1:TextField = new TextField();
            var tf2:TextField = new TextField();
            var fmt1:TextFormat = new TextFormat();
            var hW:Function = function():Number{
                return tf1.width / 2;
            };
            var hH:Function = function():Number{
                return tf1.height / 2;
            };
            
            addChild(tf1);
            addChild(tf2);
            
            tf2.text = "画面をクリック";
            tf2.selectable = false;
            
            //フォーマット
            fmt1.size = 30;
            fmt1.color = 0xFFFFFF
            
            tf1..defaultTextFormat = fmt1;
            tf1.text = "Welcome my code";
            tf1.background = true;
            tf1.backgroundColor = 0x00FF0F;
            tf1.width = 230;    //テキストBOX横幅
            tf1.height = 35;   //テキストBOX縦幅
            
            tf1.x = (this.stage.stageWidth / 2) - hW();
            tf1.y = 0 - tf1.height;
            
            stage.addEventListener(MouseEvent.CLICK, function(e:MouseEvent):void{
                Tweener.addTween(tf1, {x:stage.mouseX - hW(), y:stage.mouseY - hH(), time:1,  transition:"easeOutElastic"});
            });
        }
    }
}