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

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

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

           stage.quality = StageQuality.LOW;
           
           //this.filters = [ new BlurFilter() ];
            
            vecSpr = new Vector.<xSpr>(0,false);
            var a:xSpr; var i:int;
            for (i=0;i<256;i+=1) 
            { a=new xSpr();
             a.cx =Math.random()*465; a.cy = Math.random()*465; 
             a.sp = Math.random()*4+1;
             vecSpr.push(a); }

            stage.addEventListener(Event.ENTER_FRAME, onEnter);            
        }//ctor
        
        public var vecSpr:Vector.<xSpr>;

        public function getMag(ax:Number,ay:Number):Number
        { return Math.sqrt(ax*ax+ay*ay); }

        public function onEnter(e:Event):void
        {
            var a:xSpr; var i:int;  var ta:Number;   var num:int;
            var d:Number;
            var px:Number; var py:Number;

            graphics.clear();
            graphics.lineStyle(2,0);

            num = vecSpr.length;
            for(i=0;i<num;i+=1)
            {
              a = vecSpr[i];
              ta = Math.atan2(a.cy-235,a.cx-235);
              
              d = getMag(a.cx-235,a.cy-235);
              d/= 64;
              d*=a.sp;
              
              px = a.cx; py = a.cy;
              a.cx += Math.cos(ta) * d;
              a.cy += Math.sin(ta) * d;
           
               graphics.moveTo(px,py);
               graphics.lineTo(a.cx,a.cy);
               
           
              /*
              graphics.beginFill(0,1);
              graphics.drawCircle(a.cx,a.cy, a.sp);  
              graphics.endFill();  
               */
                
              if (a.cx>465||a.cx<0||a.cy<0||a.cy>=465)
              { a.cx=235+Math.random()*20-10; a.cy=235+Math.random()*20-10; a.sp = Math.random()*8+1; }
           
                
            }//nexti
            
            
        }//onenter

        
    }//classend
}

internal class xSpr
{
  public var cx:Number = 0;
  public var cy:Number = 0;
  public var sp:Number = 1;
  
    
      
}//xspr