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 2016-10-4

Get Adobe Flash player
by mutantleg 04 Oct 2016
    Embed
/**
 * Copyright mutantleg ( http://wonderfl.net/user/mutantleg )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/iG1x
 */

package {
    import flash.events.MouseEvent;
    import flash.events.Event;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {

            numw=32;
            numw=64; cw=8;
            vecVert = new Vector.<Number>(numw, false);
            vecNext = new Vector.<Number>(numw, false);

            vecNext[16] = -80;

            stage.addEventListener(MouseEvent.MOUSE_DOWN, onMdown);
            stage.addEventListener(MouseEvent.MOUSE_UP, onMup);
            stage.addEventListener(Event.ENTER_FRAME, onEnter);            
        }//ctor
        
        public function onMdown(e:MouseEvent):void { mbutton = 1; }
        public function onMup(e:MouseEvent):void { mbutton = 0; }
        
        public var mbutton:int = 0;
        public var ang:Number = 0;
        public var numw:int = 32;
        public var cw:Number = 16;
        
        public var vecVert:Vector.<Number>;
        public var vecNext:Vector.<Number>;
        
        public function onEnter(e:Event):void
        {
            graphics.clear();
            graphics.lineStyle(2, 0);
            
            var mx:Number; var my:Number;
            mx = stage.mouseX;
            my = stage.mouseY;
            
            var vec:Vector.<Number>;
            vec = vecVert;
            vecVert = vecNext;
            vecNext = vec;
            
            
            ang += 0.073;
            
            var ax:Number; var ay:Number;
            var bx:Number; var by:Number;
            var t:Number;
            var i:int; var h:Number;
            t = ang;
           
           graphics.beginFill(0x4080F4);
            for (i=1;i<numw-2;i+=1)
            {
               h = ( vecVert[i-1]+ vecVert[i+1] )*0.95  - vecNext[i]; 
               //h -=  h * 0.25;
               h -=  h * 0.15;
                
               vecNext[i] = h; 
               //graphics.drawCircle(i*16-8, 230+h, 4); 

               t+=0.12;
               ax = i *cw -8;
               ay = 230+h+Math.sin(t)*4;
               //graphics.drawCircle(i*cw, 230+h+Math.sin(t)*8, 4); 
               if (i==1){graphics.moveTo(ax,ay); bx=ax;by=ay;}
               graphics.lineTo(ax,ay); 
               
               if (mbutton >0 && Math.abs(i*cw - mx)<cw) { vecNext[i] = 230-my; vecVert[i] = 230-my;  }
            }//nexti
            
            graphics.lineTo(ax,465);
            graphics.lineTo(bx, 465);
            graphics.lineTo(bx, by);
           graphics.endFill();           
            
        }//onenter
        
    }//classend
}