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

Simple 2

Get Adobe Flash player
by Zahurdias.Calimero 22 Nov 2012
    Embed
package {
    import flash.display.*;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.system.Capabilities;
        
    public class myFirstApp extends Sprite
    {
            private var my_button:SimpleButton=new SimpleButton(); // scope in all file
        
            public function myFirstApp()
            {
            stage.frameRate=31;
            
            creaBoton();
            addChild(my_button);
            myListener();
            }
                
            private function creaBoton():void
            {
            my_button.x=(stage.stageWidth/2)-50;
            my_button.y=(stage.stageHeight/2)-50;
            
            my_button.upState=dibujaOff();
            my_button.overState=dibujaOn();
            my_button.hitTestState=my_button.upState;
            }
        
            private function dibujaOff():Shape
            {
            var circulo:Shape=new Shape();
            circulo.graphics.beginFill(0x000000,1);
            circulo.graphics.drawRect(0, 0, 100, 100)
            circulo.graphics.endFill();
            return(circulo);
            }

            private function dibujaOn():Shape
            {
            var circulo:Shape=new Shape();
            circulo.graphics.beginFill(0xFF0000FF,1);
            circulo.graphics.drawRect(0, 0, 100, 100)
            circulo.graphics.endFill();
            return(circulo);
            }

        
            private function myListener():void
            {
            my_button.addEventListener(MouseEvent.CLICK,click);
                function click(m:MouseEvent):void
                {
                trace('ok');
                }
            }
    }
}