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-1-3

Get Adobe Flash player
by geko 03 Jan 2011
    Embed
/**
 * Copyright geko ( http://wonderfl.net/user/geko )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/AdFP
 */

package {
    import flash.display.Sprite;
    import flash.events.Event;
    
    public class FlashTest extends Sprite {
        private var _count:int = 0;
        private var _vel:Number = 0;
        private var _max:Number = 1;
        
        public function FlashTest() {
            addEventListener(Event.ENTER_FRAME, enterFrame);
        }
        
        private function enterFrame(event:Event):void{
            _vel += Math.sin(Math.PI/2*_count/20);
            _max = Math.max(_max, _vel);
            
            graphics.clear();
            graphics.beginFill(0x0);
            graphics.lineStyle(1, 0x0);
            graphics.moveTo(stage.stageWidth/2+Math.sin(Math.PI*2*_vel/_max)*15, stage.stageHeight/2-50);
            graphics.lineTo(stage.stageWidth/2+Math.sin(Math.PI*2*_vel/_max)*15, stage.stageHeight/2-Math.cos(Math.PI*2*_vel/_max)*15);
            graphics.moveTo(stage.stageWidth/2+50, stage.stageHeight/2-Math.cos(Math.PI*2*_vel/_max)*15);
            graphics.lineTo(stage.stageWidth/2+Math.sin(Math.PI*2*_vel/_max)*15, stage.stageHeight/2-Math.cos(Math.PI*2*_vel/_max)*15);
            graphics.drawCircle(stage.stageWidth/2+Math.sin(Math.PI*2*_vel/_max)*15, stage.stageHeight/2-50, 5);
            graphics.drawCircle(stage.stageWidth/2+50, stage.stageHeight/2-Math.cos(Math.PI*2*_vel/_max)*15, 5);
            graphics.drawCircle(stage.stageWidth/2+Math.sin(Math.PI*2*_vel/_max)*15, stage.stageHeight/2-Math.cos(Math.PI*2*_vel/_max)*15, 5);
            graphics.endFill();
            _count++;
        }
    }
}