forked from: flash on 2013-4-12

by tsu_droid
♥0 | Line 46 | Modified 2013-04-12 23:35:34 | MIT License
play

ActionScript3 source code

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

// forked from geraldalewis's flash on 2013-4-12
package {
    import flash.display.Sprite;
    import flash.display.Shape;
    import flash.display.JointStyle;
    import flash.display.CapsStyle;
    public class ChangingStrokes extends Sprite {

        private var shapeX:int = 0;
        private var shapeY:int = 0;       
        
        public function ChangingStrokes() {
            var shape1:Shape = drawBox(1);
            var shape2:Shape = drawBox(2);
            var shape3:Shape = drawBox(3);
            var shape4:Shape = drawBox(4);
            var shape5:Shape = drawBox(5);
            var shape6:Shape = drawBox(6);
            var shape7:Shape = drawBox(7);
            var shape8:Shape = drawBox(8);
            var shape9:Shape = drawBox(9);
            var shape10:Shape = drawBox(10);
            var shape11:Shape = drawBox(11);
            var shape12:Shape = drawBox(12);
            //var shape13:Shape = drawBox(13);
        };
        
        private function drawBox(size:Number):Shape {
            var shape:Shape = new Shape();
            
            //shape.graphics.beginFill(0x00FF00, .5);
            shape.graphics.lineStyle(size, 0x555555, 1, true, 'normal', null, JointStyle.MITER);
            shape.graphics.drawRoundRect(8, 8, 40, 40, 10);
            
            addChild(shape);
            
            shape.scaleX = 2;
            
            if ((shapeX + 100) > 400) {
                shapeX = 0;
                shapeY += 60;
            }
            
            shape.x = shapeX;
            shape.y = shapeY;
            
            var fill:Shape = new Shape();
            fill.graphics.beginFill(0xCCCCCC, .75);
            fill.graphics.drawRoundRect(8, 8, 40, 40, 10);
            fill.scaleX = 2;
            fill.x = shapeX;
            fill.y = shapeY;
            addChild(fill);
            
            shapeX += 100;
            

            return shape;
        }

    }  
}