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 2011-7-12

Get Adobe Flash player
by tatsuhico 12 Jul 2011
    Embed
/**
 * Copyright tatsuhico ( http://wonderfl.net/user/tatsuhico )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/fFWL
 */

package{
    import flash.display.Sprite;
    import flash.display.Graphics;
    import flash.display.Stage;
    
    import flash.events.Event;
    import flash.events.MouseEvent;
    
    public class Main extends Sprite{
        private var rects:Graphics;
        private var radius:uint = 49;
        private const winW:Number = 465;
        private const winH:Number = 465;
        private var rNUM:Number = 0;
        
        private var angle:Number = 0;
        public function Main(){
            rects = this.graphics;
           
            stage.addEventListener(Event.ENTER_FRAME, moving);
            stage.addEventListener(MouseEvent.MOUSE_MOVE, setNum);
        }
        
        private function moving(e:Event):void {
            rects.clear();
            for(var i:int=0; i<winW; i+=radius+1){
                for(var j:int=0; j<winH; j+=radius+1){
                    angle += 0.01;
                    rects.beginFill(0x000000, Math.sin(angle/rNUM));
                    rects.drawRect(i, j, radius, radius);
                }
            }
            rects.endFill();
        }
        
        private function setNum(e:Event):void {
            rNUM = mouseY / winH/3;
        }
    }
}