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-9-20

Get Adobe Flash player
by mutantleg 19 Sep 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/yBiu
 */

package {
    import flash.events.Event;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            
            
            stage.addEventListener(Event.ENTER_FRAME, onEnter);
        }//ctor
       
        public function isOver(ax:Number, ay:Number,  rx:Number, ry:Number, rw:Number, rh:Number):Boolean
        {  return  ((ax < rx) || (ay < ry) || (rx+rw < ax) || (ry+rh < ay)) == false; }
        
        public function isWall(ax:Number, ay:Number):Boolean
        {
          return isOver(ax,ay, 128,128,  128,128);  
        }//iswall
        
        
        public var gt:int = 0;
        public function onEnter(e:Event):void
        {
            graphics.clear();
            graphics.lineStyle(2, 0);

            gt+=1;
            
            var ta:Number;
            var ax:Number; var ay:Number;
            ax = 320; ay = 240;
            
            ax = stage.mouseX; ay = stage.mouseY;
            
            //            graphics.drawRect(128,128, 128,128);
            graphics.beginFill(0x404040, 1);
             graphics.drawRect(0,0, 465,465);
            graphics.endFill();
            
                
            
            //graphics.drawCircle(ax,ay, 4);
            
            ta  = 3.14;
            //ta += Math.sin(gt*0.1);
            
            var i:int;
            var kx:Number; var ky:Number;
            var ca:Number; var sa:Number;
            var u:Number;
            
            graphics.lineStyle();
            graphics.beginFill(0xA0A0A0,1);
            graphics.moveTo(ax, ay);
            for (u=-1;u<=1;u+=0.02)
            {
                ca = Math.cos(ta+u) * 8; sa = Math.sin(ta+u) * 8;
                kx = ax; ky = ay;
                //graphics.moveTo(kx,ky); graphics.lineTo(kx+ca*128, ky+sa*128);
     
                for (i=0;i<32;i+=1)
                {
                  kx += ca;  ky += sa;  
                  if (isWall(kx,ky)) 
                  {
                    // kx -=ca; ky-=sa; 
                  //  kx = Math.floor(kx/8)*8;
                   // ky = Math.floor(ky/8)*8;                 
                  break; }
                }//nexti
                //graphics.drawCircle(kx, ky, 4);
                graphics.lineTo(kx,ky);
            }//nextu    
            graphics.lineTo(ax,ay);
            graphics.endFill();

            //wall drawn last to hide errors
            graphics.beginFill(0, 1);
              graphics.drawRect(128,128, 128,128);
            graphics.endFill();
            
        }//onenter
        
        
    }//classend
}