flash on 2010-3-6

by noenoe
♥0 | Line 23 | Modified 2010-06-23 19:39:34 | MIT License
play

ActionScript3 source code

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

package {
    import flash.events.Event;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public var s:Sprite;
        
        public function FlashTest() {
            // write as3 code here..
            s = new Sprite();
            this.addChild(s);
            //エディタのテスト。こんなに補完するんですね。
            
            s.graphics.beginFill(0xff0000);
            s.graphics.drawRect(0,0,10,10);
            s.graphics.endFill();
            
            this.addEventListener(Event.ADDED_TO_STAGE, _onAddedToStage);
        }
        
        private function _onAddedToStage(e:Event):void{
            this.removeEventListener(Event.ADDED_TO_STAGE, _onAddedToStage);
            
            stage.addEventListener(Event.ENTER_FRAME, _onEnterFrame);
        }
        
        private function _onEnterFrame(e:Event):void{
            s.x = this.mouseX;
            s.y = this.mouseY;
        }


    }
}