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

forked from: forked from: dot particle

...
* @author Default
* @version 0.1
Get Adobe Flash player
by mirkofresa 13 Jan 2010
    Embed
// forked from mirkofresa's forked from: dot particle
// forked from uranodai's dot particle
// write as3 code here..
/**
* ...
* @author Default
* @version 0.1
*/

package  {
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	[SWF(width="550", height="100", frameRate="30", backgroundColor="#cccccc")]
	
	public class Sample2 extends Sprite{
		
		private var _dotList:Array;
		private var _flag:Boolean = true;
		
		public function Sample2() {
			var wNum:int = 55;
			var hNum:int = 10;
			var array:int = 0;
			var dotWidth:int = 9;
			var dotHeight:int = 9;
			var dotMargin:int = 1;
			
			_dotList = [];
			
			for(var j:int=0; j<hNum; j++){
				for(var i:int=0; i<wNum; i++){
					var tempX:int = i*(dotWidth+dotMargin)+stage.stageWidth/2-wNum*((dotWidth+dotMargin)/2)+5;
					var tempY:int = j*(dotHeight+dotMargin)+stage.stageHeight/2-hNum*((dotHeight+dotMargin)/2)+5;
					//var tempX:Number = (stage.stageWidth/2-20)*Math.sin(array*2*Math.PI/stage.stageWidth)+stage.stageWidth/2;
					//var tempY:Number = (stage.stageHeight/2-20)*Math.cos(array*2*Math.PI/stage.stageHeight)+stage.stageHeight/2;
					
					var dot:Dot = new Dot(dotWidth,dotHeight,tempX,tempY);
					_dotList.push(dot);
					array++
				}
			}
			
			addEventListener(Event.ENTER_FRAME, draw);
			stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
		}
		
		private function draw(e:Event):void
		{
			graphics.clear();
			for(var i:int=0; i<_dotList.length; i++){
				_dotList[i].display(graphics);
				_dotList[i].move();
				_dotList[i].goOut();
			}
		}
		
		private function onMouseDown(e:MouseEvent):void
		{
			_flag  = !_flag;
			for(var i:int=0; i<_dotList.length; i++){
				_dotList[i].flag = _flag;
			}
		}
	}
	
}

/**
* ...
* @author Default
* @version 0.1
*/


import flash.display.Graphics;

class Dot {
	
	private var rectW:int;
	private var rectH:int;
	private var posX:Number;
	private var posY:Number;
	private var nextX:Number;
	private var nextY:Number;
	private var diffX:Number;
	private var diffY:Number;
	private var goalX:int;
	private var goalY:int;
	private var speed:Number;
	public var flag:Boolean;
	
	public function Dot(w:int, h:int, x:Number, y:Number) {
		rectW = w;
		rectH = h;
		posX = x;
		posY = y;
		nextX = x;
		nextY = y;
		goalX = x;
		goalY = y;
		speed = 0.01;
		flag = true;
	}
	
	public function display(graphic:Graphics):void
	{ var color:int;
	var muz:int=(Math.round(posX-5)/10)+(Math.round((posY-5)/10))*55;
		if(muz==79 || muz==80 || muz==99 || muz==134 || muz==135 || muz==154 || muz==155 
		|| muz==189 || muz==190 || muz==209 || muz==210 
		|| muz==222 || muz==223|| muz==224 || muz==225 || muz==228 || muz==229 || muz==230 
		|| muz==231 || muz==232 || muz==235 || muz==236|| muz==237 || muz==238 ||
		muz==239 || muz==240 || muz==243 || muz==244 || muz==245 || muz==246 || muz==247 
		|| muz==249 || muz==250 || muz==251 || muz==252 || muz==253 
		|| muz==257 || muz==258|| muz==259 || muz==260 || muz==263 || muz==264 || muz==265 
		|| muz==266 || muz==267 || muz==269 || muz==270|| muz==271 || muz==272 ||
		muz==273  || muz==276 || muz==277 || muz==283 || muz==286 || muz==287 || muz==290|| muz==291
		|| muz==294 || muz==295 || muz==299 || muz==300 || muz==308 
		|| muz==311 || muz==312|| muz==319 || muz==320 || muz==324 || muz==325 || muz==331
		|| muz==332 || muz==338 || muz==341 || muz==342|| muz==345 || muz==346 ||
		muz==349 || muz==350 || muz==354 || muz==355 || muz==359 || muz==360 || muz==361 || muz==362|| muz==363|| muz==366 || muz==367 
		|| muz==374 || muz==375 || muz==380 || muz==381 || muz==382|| muz==386 
		|| muz==387 || muz==393|| muz==396 || muz==397 || muz==400 || muz==401 || muz==404 
		|| muz==405 || muz==409 || muz==410 || muz==413 || muz==414 || muz==418 || muz==421 ||
		muz==422 || muz==429 || muz==430 || muz==437 || muz==438|| muz==442 
		|| muz==448 || muz==449 || muz==443 || muz==444 || muz==445 
		|| muz==450 || muz==451|| muz==452 || muz==455 || muz==456 || muz==459|| muz==460 
		|| muz==464 || muz==465 || muz==469 || muz==470|| muz==471 || muz==472 ||
		muz==473 || muz==477 || muz==478 || muz==479 || muz==480 || muz==484 || muz==485
		|| muz==489 || muz==490 || muz==491 || muz==492 || muz==493)  
		{
			color =0x555555;
	} else{
		       color =0xffffff;
		};
		graphic.beginFill(color);
		graphic.drawRect(posX-rectW/2, posY-rectH/2, rectW, rectH);
		graphic.endFill();
		
	}
	
	public function move():void
	{
		if(flag){
			nextX = goalX;
			nextY = goalY;
			speed = 0.1;
		}else{
			nextX += Math.random()*100-50;
			nextY += Math.random()*100-50;
			speed = 0.01;
		}
		
		diffX = (posX-nextX)*speed;
		diffY = (posY-nextY)*speed;
		
		posX -= diffX;
		posY -= diffY;
	}
	
	public function goOut():void
	{
		if(posX>550+rectW){
			posX = 0;
			nextX = 0;
		}
		if(posY>100+rectH){
			posY=0;
			nextY=0;
		}
		if(posX<0-rectW){
			posX = 550;
			nextX = 550;
		}
		if(posY<0-rectH){
			posY  = 100;
			nextY = 100;
		}
	}
	
}