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

mouse_circles_edited

Get Adobe Flash player
by hacker_fbg_ju_j 05 May 2010
/**
 * Copyright hacker_fbg_ju_j ( http://wonderfl.net/user/hacker_fbg_ju_j )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/ur6R
 */

package {

	import flash.display.*;
	import flash.events.*;



       public class MouseToy extends MovieClip {
		private var circles:Array;


               public function MouseToy(){
                  // init
			circles = [];
			for (var i:int = 0; i<30; i++){
				var c:Sprite = makeCircle();
				c.x = stage.stageWidth / 2;
				c.y = stage.stageHeight / 2;
				c.scaleX = 2 + i/2;
				c.scaleY = 0.5 + i/4;
				addChild(c);
				circles.push(c);
			}
			addEventListener(Event.ENTER_FRAME, onLoop);
			
			
			
			

               }
               // private methods

		private function onLoop(evt:Event):void {
			circles[0].y += (mouseY - circles[0].y) / 8;
			for (var i:int = 1; i<circles.length; i++){
				var pre:Sprite = circles[i - 1];
				circles[i].y += (pre.y - circles[i].y) / 8;
			}
		}
		private function makeCircle():Sprite{
			var s:Sprite = new Sprite();
			with(s.graphics){
				lineStyle(0,0x002002);
				drawCircle(0,0,10);
			}
			return s;
		}
		

       }

}