flash on 2010-1-29

by hacker_9p8x8mco
♥0 | Line 40 | Modified 2010-01-29 07:16:12 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    import flash.text.TextField;
    import flash.text.TextFormat;
    import flash.events.*;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            var tf:TextField = new TextField();
            var fmt:TextFormat = new TextFormat();
            tf.width = 250;
            fmt.font = "Verdana";
            fmt.size = 20;
            fmt.bold = true;
            fmt.align = "center";
            fmt.bullet = true;
            fmt.color = 0x0000FF;
            fmt.italic = true;
            fmt.letterSpacing = 15;
            tf.defaultTextFormat = fmt;
            tf.text = "test";
            var sp:Sprite =new Sprite();
            sp.graphics.beginFill(0xff0000);
            sp.graphics.drawRect(0,0,250,250);
            sp.graphics.endFill();
            tf.mouseEnabled = false;
           
            sp.addEventListener(MouseEvent.MOUSE_DOWN,onMouseDown);
            function onMouseDown(evt:MouseEvent):void{
                    evt.target.startDrag();
            }
            sp.addEventListener(MouseEvent.MOUSE_UP,onMouseUp);
            function onMouseUp(evt:MouseEvent):void{
            		evt.target.stopDrag();
            }
            addChild(sp);
            sp.addChild(tf);
            sp.x = 100;
            sp.y = 100;
        }
    }
}