flash on 2010-2-11

by hacker_j0htd766
♥0 | Line 44 | Modified 2010-02-11 13:19:52 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    public class MouseClick extends Sprite {
    	private var _button:MyButton;
    	
    	public function MouseClick(){
    		_button = new MyButton();
    		_button.addEventListener(MouseEvent.MOUSE_OVER,onMouseOver);
    		_button.addEventListener(MouseEvent.MOUSE_OUT,onMouseOut);
    		
    		addChild(_button);
    		
    		_button.x =182;
    		_button.y =50;
    	}
    	
    	private function onMouseOver(e:MouseEvent):void{
    		_button.over();
    	}
    	private function onMouseOut(e:MouseEvent):void{
    		_button.out();
    	}
    
  }

}

import flash.display.Sprite;
class MyButton extends Sprite {
	private var _over:Sprite;
		
         public function MyButton() {
        	graphics.beginFill(0x333333);
        	graphics.drawRoundRect(0,0,100,22,15);
        	graphics.endFill();
        	
        	_over = new Sprite();
        	_over.graphics.beginFill(0xff0000);
        	_over.graphics.drawRoundRect(0,0,100,22,15);
        	_over.graphics.endFill();
        	_over.visible = true;
        	
        	addChild(_over);
        	
        	buttonMode = true;
        }
        
        public function over():void{
        	_over.visible = false;
        }
        
        public function out():void{
        	_over.visible = true;
        }
    }