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 2012-6-14

Get Adobe Flash player
by mutantleg 14 Jun 2012
    Embed
/**
 * Copyright mutantleg ( http://wonderfl.net/user/mutantleg )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/uMXc
 */

package {
    import flash.events.Event;
    import flash.display.Graphics;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        
        public var vecLine:Array = new Array();
        
        public function FlashTest() {
            // write as3 code here..
            
            var s:Sprite;
            var g:Graphics;
            var i:int;
            var m:Number;
            
            curheight = 300;
            var num:int;
            num = 640 / 32;
            for (i = 0; i < num; i++)
            {
                s = new Sprite();
                g = s.graphics;
                g.clear();
                g.beginFill(0,1);
                g.drawRect(-16,0,32,256);
                g.endFill();
                
                s.x = i * 32;
               curheight += (Math.random()-Math.random()) * 64;
                        if (curheight < 250) {curheight = 250;}
                        if ( curheight> 450) {curheight = 450;}
                         s.y = curheight;
               
                addChild(s);              
                vecLine.push(s);  
            }//nexti
            
            stage.addEventListener(Event.ENTER_FRAME, onEnter);
        }//ctor
        
        public var curheight:Number = 300;
        
        public function onEnter(e:Event):void
        {
            var num:int;
            var i:int;
            var s:Sprite;
            num = vecLine.length;
            
            for (i = 0; i < num; i++)
            {
                s = vecLine[i];
                s.x -= 2;
                if (s.x <= -16) 
                 { 
                    s.x += 640; 
                     curheight += (Math.random()-Math.random()) * 64;
                        if (curheight < 250) {curheight = 250;}
                        if ( curheight> 450) {curheight = 450;}
                         s.y = curheight;
                  }//endif
                }//nexti
            
        }//onenter
        
    }//classend
}