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

flash on 2010-4-13

Get Adobe Flash player
by kihon 31 Jul 2010
    Embed
/**
 * Copyright kihon ( http://wonderfl.net/user/kihon )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/o66yY
 */

package
{
    import flash.display.Sprite;
    import flash.events.MouseEvent;
 
    public class Main extends Sprite
    {
        public function Main()
        {
            var button:Button = new Button();
            button.x = 232;
            button.y = 232;
            button.addEventListener(MouseEvent.CLICK, function():void { trace("CLICK"); } );
            addChild(button);
        }
    }
}
 
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.filters.DropShadowFilter;
import flash.geom.Matrix;
import flash.text.TextField;
import flash.text.TextFormat;
 
class Button extends Sprite
{
    public function Button()
    {
        var matrix:Matrix = new Matrix();
        matrix.createGradientBox(60, 60, 90 * Math.PI / 180, -15, -15);
 
        graphics.lineStyle(3.0, 0x393939);
        graphics.beginGradientFill("linear", [0xE4EFD7, 0x5B9E2E, 0x066701], [1.0, 1.0, 1.0], [0, 128, 255], matrix);
        graphics.drawCircle(0, 0, 30);
        graphics.endFill();
 
        this.buttonMode = true;
        this.mouseChildren = false;
        this.filters = [new DropShadowFilter()];
 
        var tf:TextField = new TextField();
        tf.defaultTextFormat = new TextFormat("_typeWriter", 18, 0x393939, true);
        tf.text = "OK";
        tf.x = -13;
        tf.y = -13;
        tf.selectable = false;
        addChild(tf);
 
        addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
        addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
        addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
    }
 
    private function onMouseOut(event:MouseEvent):void
    {
        this.filters = [new DropShadowFilter()];
    }
 
    private function onMouseUp(event:MouseEvent):void
    {
        this.filters = [new DropShadowFilter()];
    }
 
    private function onMouseDown(event:MouseEvent):void
    {
        this.filters = [new DropShadowFilter(2)];
    }
}