flash on 2011-5-8

by TmskSt
♥0 | Line 24 | Modified 2011-05-08 22:36:32 | MIT License
play

ActionScript3 source code

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

package {
    import flash.text.TextField;
    import flash.display.Sprite;
    import flash.events.*;
    public class FlashTest extends Sprite {
        
        // IEやSleipnirでEvent.DEACTIVATEが取得できない
        
        private var tf:TextField;        
        
        
        public function FlashTest() {
            // write as3 code here..
            this.addEventListener(Event.ADDED, init);
        }
        
        private function init(e:* = null):void {
            this.removeEventListener(Event.ADDED, init);
            
            stage.addEventListener(Event.ACTIVATE, a);
            stage.addEventListener(Event.DEACTIVATE, d);
            
            this.tf = this.addChild(new TextField()) as TextField;
            this.tf.text = "CLICK ME";
        }
        
        private function a(e:* = null):void {
            this.tf.text = "Event.ACTIVATE";
        }
        
        private function d(e:* = null):void {
            this.tf.text = "Event.DEACTIVATE";
        }


    }
}