flash on 2009-11-24

by cheapcode
♥0 | Line 35 | Modified 2009-11-25 12:56:37 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    import flash.text.*;
    import net.hires.debug.Stats;
    
    [SWF(backgroundColor="#ffffff", frameRate=60)]
    public class Main extends Sprite {
        private var textfield:TextField;

            public function Main() {
            var text:String="";
            var tbl:Array=new Array();
            addChild( new Stats() );
  
            addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
  
            for( var i:int=0; i<=360; i++ ) {
                tbl[i]= int((Math.sin(i*Math.PI/180)*0x800000+0x800000)%0x1000000);
            }
          
          var col:int=0;
            for( var y: int=0; y<465; y++ ) 
            {
                for( var x: int=0; x<465; x++ ) 
                {
//                    var col:int = int((Math.sin((x+y)*Math.PI/180)*0x800000+0x800000)%0x1000000);
                    graphics.beginFill(tbl[col%360]);
                    graphics.drawRect(x, y, 1, 1);
                    graphics.endFill();
                    col++;
                }
            }

/*
            textfield = new TextField();
            textfield.x = textfield.y = 0;
            textfield.width = textfield.height = 465;
            textfield.text = text;
            addChild(textfield);
*/
        }
        
        private function onMouseDown(event:MouseEvent):void {
            graphics.beginFill(0xffffff);
            graphics.drawRect(mouseX, mouseY, 20, 20);
            graphics.endFill();
        }
    }
}