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

venom

click on the screen :]
Get Adobe Flash player
by yAKIr 11 Jun 2011
/**
 * Copyright yAKIr ( http://wonderfl.net/user/yAKIr )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/zN1K
 */

package {
    import flash.display.*;
    import flash.events.*;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            var screen:Shape = new Shape();
            this.addChild(screen);
            import flash.display.Graphics;

function newBranch(x_:Number, y_:Number, speedx:Number, speedy:Number, level:int):void
{
	//lines.push(new Array());
	//lines[lines.length - 1].push({X:x_, Y:y_});
	points.push({X:x_, Y:y_, speedX:speedx, speedY:speedy, Level:level});
}
var lines:Array= new Array();
var points:Array=new Array();

for (var b:int=0; b<3; b++)
{
	newBranch(200, 0, Math.random()*6-3, Math.random()*3, 0);
}
screen.graphics.lineStyle(1, 0, 1);
addEventListener(Event.ENTER_FRAME,EF);
function EF():void
{
	for (var i:int=0; i<points.length; i++)
	{
		if (points[i].speedX != 0 || points[i].speedY != 0)
		{
			screen.graphics.moveTo(points[i].X, points[i].Y);
			points[i].X +=  points[i].speedX;// + Math.random() * 2 - 1;
			points[i].Y +=  points[i].speedY;
			screen.graphics.lineTo(points[i].X, points[i].Y);
			points[i].speedX *=  0.9;
			//points[i].speedY+=0.1;
			//lines[i].push({X:points[i].X, Y:points[i].Y});
			var l:int = points[i].Level;
			if (Math.random() * 10 < 1)
			{
				points[i].speedX = 0;
				points[i].speedY = 0;
				if (l < 10)
				{
					for (var b:int=1; b<Math.random()*4; b++)
					{
						newBranch(points[i].X, points[i].Y, Math.random()*10-5, Math.random()*5,l+1);
					}
				}
			}
		}
	}
	/*
	this.graphics.clear();
	this.graphics.lineStyle(1, 0, 1);
	for (i=0; i<lines.length; i++)
	{
	this.graphics.moveTo(lines[i][0].X, lines[i][0].Y);
	for (var a:int=0; a<lines[i].length; a++)
	{
	this.graphics.lineTo(lines[i][a].X, lines[i][a].Y);
	}
	}*/
}
stage.addEventListener(MouseEvent.MOUSE_DOWN, mouse_down);
function mouse_down():void
{
	newBranch(mouseX, mouseY, Math.random()*6-3, Math.random()*3, 0);
}
        }
    }
}