In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

プルダウンみたいな

Get Adobe Flash player
by kazuyuki 21 Feb 2010
    Embed
/**
 * Copyright kazuyuki ( http://wonderfl.net/user/kazuyuki )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/2SgF
 */

package {
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    public class FlashTest extends Sprite {
        public function FlashTest() {
           var button:MyButton = new MyButton();
           button.x = 100;
           button.y = 100;
           addChild(button);
           
           button.addEventListener(MouseEvent.MOUSE_OVER,onMouseOver);
           button.addEventListener(MouseEvent.MOUSE_OUT,onMouseOut);
           
           function onMouseOver(e:MouseEvent):void{
           	button.over();
           }
           
           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,22,100,22,15);
		_over.graphics.endFill();
		_over.graphics.beginFill(0xffff00);
		_over.graphics.drawRoundRect(0,44,100,22,15);
		_over.graphics.endFill();
		_over.graphics.beginFill(0x0000ff);
		_over.graphics.drawRoundRect(0,66,100,22,15);
		_over.graphics.endFill();
		_over.visible = false;
		addChild(_over);
		buttonMode = true;
	}
	
	public function over():void{
		_over.visible = true;
	}
	
	public function out():void{
		_over.visible = false;
	}
}