[TextField]FocusIn/Outのテスト

by stenpel
♥1 | Line 22 | Modified 2010-05-24 16:43:53 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    import flash.text.TextField;
    import flash.events.*;
    public class FlashTest extends Sprite {
    	private var tf:TextField;
        public function FlashTest() {
            // write as3 code here..
            tf = new TextField();
            tf.addEventListener(FocusEvent.FOCUS_IN, onFocusIn);
            tf.addEventListener(FocusEvent.FOCUS_OUT, onFocusOut);
            addChild(tf);
            tf.text = "test";
            tf.border = true;
        }
        
        private function onFocusIn(e:FocusEvent):void {
        		tf.text = "FocusIn";
        }
        
        private function onFocusOut(e:FocusEvent):void {
        		tf.text = "FocusOut";		
        }
    }
}