flash on 2010-2-18

by atsumo
♥0 | Line 31 | Modified 2010-02-18 21:47:48 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    import flash.events.*;
    
    import flash.geom.Matrix;
    public class FlashTest extends Sprite {
    		private var _box:Sprite;
    		
        public function FlashTest() {
            
            _box = new Sprite();
            _box.graphics.beginFill(0x000000);
            _box.graphics.drawRect(0,0,100,20);
            _box.graphics.endFill();
            
            _box.x = (stage.stageWidth - _box.width)/2;
            _box.y = (stage.stageHeight - _box.height)/2;
            addChild(_box);
            
            _box.addEventListener(MouseEvent.ROLL_OVER, handleRollOver);
            _box.addEventListener(MouseEvent.ROLL_OUT, handleRollOut);
        }
        
        private function handleRollOver(e:Event):void
        {
        		var sp:Sprite = e.target as Sprite;
        		sp.alpha = .5;
        		sp.scaleX = sp.scaleY = 1.2;
        }
        
        private function handleRollOut(e:Event):void
        {
        		var sp:Sprite = e.target as Sprite;
        		sp.alpha = 1;
        		sp.scaleX = sp.scaleY = 1;
        }
    }
    
}