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

ColorSquare (2)

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

////////////////////////////////////////////////////////////////////////////////
// ColorSquare (2)
////////////////////////////////////////////////////////////////////////////////

package {

    import flash.display.Sprite;
    import flash.display.Shape;
    import flash.geom.Matrix;
    import flash.display.GradientType;
    import flash.display.SpreadMethod;
    import flash.display.InterpolationMethod;

    [SWF(backgroundColor="#000000", width="465", height="465", frameRate="30")]

    public class Main extends Sprite {
        private var rect:Shape;

        public function Main() {
            //Wonderfl.capture_delay(1);
            init();
        }

        private function init():void {
            graphics.beginFill(0x000000);
            graphics.drawRect(0, 0, 465, 465);
            graphics.endFill();
            //
            rect = new Shape();
            addChild(rect);
            rect.x = 32;
            rect.y = 32;
            var colors:Array = [0xFF0000, 0xFFFF00, 0x00FF00, 0x00FFFF, 0x0000FF, 0xFF00FF, 0xFF0000];
            var alphas:Array = [1, 1, 1, 1, 1, 1, 1];
            var ratios:Array = [0, 42, 85, 127, 170, 212, 255];
            var matrix:Matrix = new Matrix();
            matrix.createGradientBox(400, 400, 0, 0, 0);
            rect.graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix, SpreadMethod.PAD, InterpolationMethod.RGB, 0);
            rect.graphics.drawRect(0, 0, 400, 400);
            rect.graphics.endFill();
            var color:Array = [0x000000, 0x000000];
            var alpha:Array = [0, 1];
            var ratio:Array = [0, 255];
            var _matrix:Matrix = new Matrix();
            _matrix.createGradientBox(400, 400, Math.PI*0.5, 0, 0);
            rect.graphics.beginGradientFill(GradientType.LINEAR, color, alpha, ratio, _matrix, SpreadMethod.PAD, InterpolationMethod.RGB, 0);
            rect.graphics.drawRect(0, 0, 400, 400);
            rect.graphics.endFill();
        }
        
    }

}