forked from: flash on 2011-12-8

by rodrigocardozo
♥0 | Line 35 | Modified 2011-12-09 22:09:23 | MIT License
play

ActionScript3 source code

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

// forked from DigitalD's flash on 2011-12-8
package {
    import flash.display.GraphicsPathCommand;
    import flash.display.Shape;
    import flash.events.Event;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
        
        // write as3 code here..
        const TWO_PI:Number = Math.PI * 2;
         
        var resolution:Number = 50;
        var step:Number = TWO_PI / resolution;
        var maxIndex:int = 0;
         
        var coords:Vector.<Number> = new Vector.<Number>();
        var drawCommands:Vector.<int> = new Vector.<int>();
         
        for (var i:Number = 0; i <TWO_PI + step; i += step){
        coords.push(100 * Math.cos(i));
        coords.push(100 * Math.sin(i));
        drawCommands.push(GraphicsPathCommand.LINE_TO);
        }
         
        var circleSegment:Shape = new Shape();
        circleSegment.rotation = -90;
        circleSegment.x = circleSegment.y = 200;
        addChild(circleSegment);
         
        addEventListener(Event.ENTER_FRAME, onLoop);
        function onLoop(evt:Event):void {
        with (circleSegment.graphics) {
        clear();
        beginFill(0x0F00100);
        maxIndex = Math.ceil((mouseX / stage.stageWidth)  * drawCommands.length) * 2;
        drawPath(drawCommands, coords.slice(0, maxIndex));
        trace('a');
        }
        }        
        
        }
    }
}