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

単振動

Get Adobe Flash player
by 9re 15 Jul 2009
    Embed
/**
 * Copyright 9re ( http://wonderfl.net/user/9re )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/hpcz
 */

package {
    import flash.display.Sprite;
    import flash.events.Event;
    
    [SWF(frameRate="0")]
    public class FlashTest extends Sprite {
        public function FlashTest() {
            var _y:Number = 100;
            var _v:Number = 0;
            var K:Number = 0.001;
            var _x:int = 0;
            
            graphics.lineStyle(1);
            addEventListener(Event.ENTER_FRAME, function(e:Event):void {
                var v = _v;
                
                _v -= (_y * K);
                _y += _v; // what happens if this line is _y += v; ?
                
                if (_x == 0)
                    graphics.moveTo(_x, stage.stageHeight / 2 + _y);
                else
                    graphics.lineTo(_x, stage.stageHeight / 2 + _y);
                if (++_x > stage.stageWidth) {
                    graphics.clear(); _x = 0;
                    graphics.lineStyle(1);
                }
            });
        }
    }
}