flash on 2010-8-31

by sixgen
♥0 | Line 44 | Modified 2010-09-04 01:05:57 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.*;
    import flash.text.*;
    import flash.events.*;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            var t:TextField = new TextField;
            t.autoSize = TextFieldAutoSize.LEFT;
            t.type = TextFieldType.INPUT;
            t.text = "한글제목English too";
              
            t.x = 20; 
            
            
//            addChild(t);
            
            var sh:Sprite = new Sprite;
            sh.graphics.beginFill( 0x555555, 1); 
            sh.graphics.drawRoundRect(0,0,20,20,10,10);
            addChild(sh);  
            sh.addChild(t);
            sh.addEventListener( MouseEvent.MOUSE_OVER, function():void{
                sh.graphics.clear();
                sh.graphics.beginFill( 0x555555, 1);
                sh.graphics.drawRoundRect(0,0,20,20,10,10);
            });
 
            sh.addEventListener( MouseEvent.MOUSE_OUT, function():void{
                sh.graphics.clear();
                sh.graphics.beginFill( 0x999999, 1);
                sh.graphics.drawRoundRect(0,0,10,20,10,10);
            });
           
            sh.addEventListener( MouseEvent.MOUSE_DOWN, function():void{
                sh.startDrag();
            });
            sh.addEventListener( MouseEvent.MOUSE_UP, function():void{
                stopDrag();
            });          


        var my_txt:TextField = new TextField();
          my_txt.text = "Flash Macintosh version";
          var my_fmt:TextFormat = new TextFormat();
          my_fmt.color = 0xFF0000; 
          my_txt.defaultTextFormat = my_fmt;
          my_txt.setSelection(6,15); // partial text selected - defaultTextFormat not applied
          my_txt.setSelection(6,23); // text selected to end - defaultTextFormat applied
          my_txt.replaceSelectedText("Windows version");

        addChild(my_txt);
        //my_txt.x = 200; 
        
          
        }
    }
}