flash on 2010-7-31

by simultechnology
♥0 | Line 31 | Modified 2010-07-31 12:50:37 | MIT License
play

ActionScript3 source code

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

     

package 
{
    import flash.display.Sprite;
    import flash.events.Event;
    import caurina.transitions.Tweener;
    
    import flash.events.*;

    public class Main extends Sprite 
    {
        private var box:Sprite = new Sprite();
        
        public function Main():void 
        {
            if (stage) init();
            else addEventListener(Event.ADDED_TO_STAGE, init);
        }
        
        private function init(e:Event = null):void 
        {
            removeEventListener(Event.ADDED_TO_STAGE, init);
            // entry point
            box.graphics.beginFill(0x000000, 1);
            box.graphics.drawRect(50, 50, 100, 100);
            box.addEventListener(MouseEvent.MOUSE_OVER, btnHandler);
            box.addEventListener(MouseEvent.MOUSE_OUT, btnRollOutHandler);

            addChild(box);

        }
        
        private function btnHandler(e:Event):void {
            Tweener.addTween(e.target, { rotation: -10, time:0.1, transition:"easeoutquad" } );
        }
        private function btnRollOutHandler(e:Event):void {
            Tweener.addTween(e.target, { rotation: 0, time:0.1, transition:"easeoutquad" } );
        }
    }
    
}