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-2-22

Get Adobe Flash player
by mutantleg 22 Feb 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/eA4T
 */

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

            deb = new TextField();
            deb.width=320; deb.height=240;
            deb.mouseEnabled=false;
            addChild(deb);

            
            vecPlat = new Vector.<Number>(2, false);            
            vecPlat[0] = 64;  vecPlat[1] = 0;
            
            vecPlat = new Vector.<Number>(0, false);  
            var i:int;
            for (i = 0; i < 32; i++)      {   vecPlat.push(i*16);  vecPlat.push(i*0.2);  }
            
            for (i = 0; i < 16; i++)      {   vecPlat.push(128);   vecPlat.push(i*(6.28/16));   }
      
            for (i = 0; i < 16; i++)      {   vecPlat.push(256+128); vecPlat.push(i*(6.28/16));  }
      
            
            stage.addEventListener(Event.ENTER_FRAME, onEnter);
        }//ctor
        
        public var deb:TextField;
        
        public var vecPlat:Vector.<Number>;
        
        public var cyaw:Number = 0;
        public var cy:Number = 0;

        public var gt:int = 0;
        
        public function onEnter(e:Event):void
        {
            graphics.clear();
            graphics.lineStyle(2, 0);
            
            graphics.beginFill(0x202080,1);    graphics.drawRect(0,0,465,465);        graphics.endFill();
            graphics.beginFill(0x4040a0,1);    graphics.drawRect(0,128-cy*0.1,465,128);        graphics.endFill();
            
            //graphics.lineStyle(1, 0x808080);
            drawVec(vecPlat, 0);
           
            graphics.lineStyle(2, 0);
            
            graphics.beginFill(0, 1);  graphics.drawRect(128, 0, 192, 465);   graphics.endFill();
            graphics.beginFill(0x404040, 1);  graphics.drawRect(128+16, 0, 192-32, 465);   graphics.endFill();
            graphics.beginFill(0x808080, 1);  graphics.drawRect(128+48, 0, 192-96, 465);   graphics.endFill();
 
            
            drawVec(vecPlat, 1);
            
            cyaw += 0.04;
            
            cy = Math.sin(gt*0.02)*128;
            
            gt+=1;
        }//onenter

        public function drawVec(vec:Vector.<Number>, mode:int=0):void
        {
            var i:int; var num:int;
            var ay:Number; var ax:Number;
            var u:Number; var w:Number;
            num = vec.length;
            for (i = 0; i < num; i+=2)
            {
                ay = vec[i]-cy;   u = vec[i+1] + cyaw;
                w = Math.cos(u);
                if (mode == 0) { if (w > 0) {continue; } }
                else  { if (w < 0) {continue; } }
                
                u = Math.sin(u);
                ax = u *128 + (128+96);
                
                graphics.beginFill(0xFFffFF, 1);
                 graphics.drawRect(ax-32, ay-9,64,16);
                graphics.endFill();
                //graphics.drawCircle(ax, ay, 8);
                
            }//nexti            
            
        }//drawvec
        
        
        
    }//classend
}