クリックイベントを発生させる

by _wonder forked from カスタムイベント (diff: 37)
♥0 | Line 21 | Modified 2010-01-12 19:36:15 | MIT License
play

ActionScript3 source code

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

// forked from _wonder's カスタムイベント
package {
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.text.TextField;
    
    [SWF( width="465", height="465", backgroundColor="0xffffff", frameRate="30" )]
    public class EventTest extends Sprite {
        private var txt:TextField;
        private var up_event:String = "up_event";
        public function EventTest() {
  
            txt = new TextField();
            txt.text = "defalut";
            addChild(txt);
            
            stage.addEventListener(MouseEvent.CLICK, push);
            stage.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
            
        }
        
        private function push(e:MouseEvent):void {
            txt.text = "push";    
        }
    }
}