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 2013-1-16

Get Adobe Flash player
by mutantleg 15 Jan 2013
    Embed
/**
 * Copyright mutantleg ( http://wonderfl.net/user/mutantleg )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/3THC
 */

package {
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.events.Event;
    import flash.geom.Point;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        
        public var mwidth:int = 8;
        public var mheight:int = 8;
        public var vecPoint:Vector.<Point>;
        public var vecIndex:Vector.<uint>;
        
       // public var bm:BitmapData;
        
        public function FlashTest() {
            /*
            bm = new BitmapData(32,32,false,0);
            bm.perlinNoise(bm.width,bm.height,12,4,false,false,7);
            */
            /*
            
            var debt:Bitmap;
            debt = new Bitmap(bm);
            addChild(debt);
            */
            
            
          var i:int;
          var k:int;
          var p:Point;
      
          vecPoint = new Vector.<Point>;
          vecIndex = new Vector.<uint>;
      
          graphics.clear();
          graphics.lineStyle(2,0);
      
          for (i = 0; i <mheight; i++)
          {    
              for (k = 0; k < mwidth; k++)
              {
                  p = new Point(16+k*32, 16+i*32);
                  vecPoint.push(p);
                  graphics.drawCircle(p.x, p.y, 4);
              
              }//nextk  
          }//nexti
          
          
          
          
          /*
          vecIndex.push(0);
          vecIndex.push(1);
          vecIndex.push(0+mwidth);
          
          vecIndex.push(1);
          vecIndex.push(0+mwidth);
          vecIndex.push(1+mwidth);
          */
          /*
          vecIndex.push(mwidth-2);
          vecIndex.push(mwidth-1);
          vecIndex.push(mwidth-2+mwidth);
          */
          /*
          vecIndex.push(0+mwidth*(mheight-2));
          vecIndex.push(1+mwidth*(mheight-2));
          vecIndex.push(0+mwidth*(mheight-2)+mwidth);
          */
          /*
          vecIndex.push(mwidth-2+mwidth*(mheight-2));
          vecIndex.push(mwidth-1+mwidth*(mheight-2));
          vecIndex.push(mwidth-2+mwidth+mwidth*(mheight-2));
        */
        /*
          vecIndex.push(0+1);
          vecIndex.push(1+1);
          vecIndex.push(0+1+mwidth);
         */
         
          var ei:int;
          var ek:int;
          var yt:int;
          
          ek = mwidth - 1;
          ei = mheight - 1;
          
  //        i = mheight-2;
   //       yt = i * mwidth;
          for (i = 0; i < ei; i++)
          {
              yt = i *mwidth;
          

          for (k = 0; k < ek; k++)
          {
              vecIndex.push(0+k+yt);
              vecIndex.push(1+k+yt);
              vecIndex.push(0+k+mwidth+yt);
              
              vecIndex.push(1+k+yt);
              vecIndex.push(0+k+mwidth+yt);
              vecIndex.push(1+k+mwidth+yt);
              
          }//nextk
          
          }//nexti
          
          stage.addEventListener(Event.ENTER_FRAME, onEnter);
        }//ctor
          
          
          public var ang:Number = 0;
          public var ang2:Number = 0;
          
        public function onEnter(e:Event):void
        {
            graphics.clear();
            
          var i:int;  
          var k:int;
          var yt:int;
          var num:int;
          var p:Point;
          
          ang += 0.07;
          ang2 += 0.12;
          
          var a:Number;
          var b:Number;
          
          a = ang;
          b = ang2;
          
            graphics.lineStyle(1,0);
      
          for (i = 0; i <mheight; i++)
          {    
              yt = i *mwidth;
              for (k = 0; k < mwidth; k++)
              {
                  a += 1.1;
                  b += 1.5;
                  
                  
                  p = vecPoint[yt+k];
                  
                  p.x = 16 + (k*32+(8*Math.sin(a)+Math.cos(b)));
                  p.y = 16 + (i*32+(8*Math.cos(b)+Math.sin(a))); 
                  
                 // p = new Point(16+k*32, 16+i*32);
                  //vecPoint.push(p);
                  graphics.drawCircle(p.x, p.y, 2);
              
              }//nextk  
          }//nexti
          
          //return;
          
          num = vecIndex.length;
          
          for (i = 0; i < num; i++)
          {
              p = vecPoint[ vecIndex[i] ];
              
             if (i % 3 == 0) 
             {
                 //graphics.beginBitmapFill(bm,null,false);
               graphics.beginFill(0xFF0F00FF,0.6);
               graphics.moveTo(p.x,p.y);  
               continue;
             } 
             graphics.lineTo(p.x,p.y);
             
             if (i % 3 == 2)
             {
               p = vecPoint[vecIndex[i-2]];
               graphics.lineTo(p.x,p.y); 
               graphics.endFill();
             }
             
          }//nexti
          
          
            
        }//onenter
        
    }//classend
}