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 2015-7-10

Get Adobe Flash player
by mutantleg 10 Jul 2015
    Embed
/**
 * Copyright mutantleg ( http://wonderfl.net/user/mutantleg )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/oUz5
 */

package {
    import flash.geom.Rectangle;
    import flash.display.BitmapData;
    import flash.events.Event;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
         
         vecHeight = new Vector.<Number>(512, false);
         pic = new BitmapData(465,465, false, 0xFFffFFff);
         
         var ta:Number;
         var r:Rectangle;    var i:int;
         r = new Rectangle();
         r.width = 1; r.height = 465; 
         for (i =0; i < 465; i++)
         {
             ta = i*0.02;
             vecHeight[i] = Math.sin(ta)*64 + 256;
             
             r.x = i;
             r.y = vecHeight[i];             
             pic.fillRect(r, 0xFF000000);                          

             r.y += 8;             
             pic.fillRect(r, 0xFF004000);                          
             
         }//nexti   
            
            stage.addEventListener(Event.ENTER_FRAME, onEnter);
        }//ctor

        public var cx:Number = 230;
        public var cy:Number = 0;
        public var rad:Number = 8;
        
        public var pic:BitmapData;        
        public var vecHeight:Vector.<Number>;
        
        public function getHeight(ax:Number):Number
        {
          if (ax < 0) { return 0; } 
          else if (ax >= 512) {return 0; }
          return vecHeight[int(ax)];
        }//getheight

        public function onEnter(e:Event):void
        {
           var mx:Number; var my:Number;
           mx = stage.mouseX; my = stage.mouseY; 
            
           graphics.clear();
           graphics.lineStyle(2, 0); 

            graphics.beginBitmapFill(pic,null,false,false);
             graphics.drawRect(0,0,465,465);
            graphics.endFill();
            
            cx += 1; if (cx >= 465) { cx = 0; }
            cx = mx;
            cy = getHeight(cx);
            //graphics.drawCircle(cx,cy-rad,rad);

            var ta:Number;            
            var kx:Number;            var ky:Number;
            var sa:Number;            var ca:Number;
            var hy:Number;
            var h:Number; 
            h= 24;
            
            ta = cx *0.1;
            
            ca = Math.cos(ta);     sa = Math.sin(ta);
            if (sa > 0) { sa = 0;}            
             kx = cx + ca*rad;
             ky = getHeight(kx) - rad + sa * h;
             hy = ky;          
            
            graphics.drawCircle(kx,ky, 8);
            
            
            ta += 3.1415; 
            ca = Math.cos(ta);     sa = Math.sin(ta);
            if (sa > 0) { sa = 0;}            
             kx = cx + ca*rad;
             ky = getHeight(kx) - rad + sa * h;
             hy += ky;

            graphics.drawCircle(kx,ky, 8);
            
            hy /= 2;
            graphics.drawCircle(cx,hy-32,rad*2);
            
        }//onenter
        
        
   
        
        
        
    }//classend
}