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

Line by mouse

...
@author Thi
/**
 * Copyright Thy ( http://wonderfl.net/user/Thy )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/dl1f
 */

package 
{
	import flash.display.Sprite;
	import flash.display.StageQuality;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.ui.Mouse;
	
	/**
	 * ...
	 * @author Thi
	 */
	public class Main extends Sprite 
	{
		
		public function Main():void 
		{
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event = null):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			// entry point
			stage.frameRate = 0
			stage.quality = StageQuality.LOW
			stage.addEventListener(MouseEvent.MOUSE_MOVE, ativar)
			//
			Mouse.hide()
			addChild(new Folow(800))
			//addChild(new Folow())
			
			
		}
		
		private function ativar(e:MouseEvent = null):void
		{
			stage.frameRate = 40
			stage.removeEventListener(MouseEvent.MOUSE_MOVE, ativar)
			stage.addEventListener(Event.MOUSE_LEAVE, desativar)
			stage.quality = StageQuality.BEST;
		}
		
		private function desativar(e:Event = null):void
		{
			stage.frameRate = 0
			stage.addEventListener(MouseEvent.MOUSE_MOVE, ativar)
			stage.removeEventListener(Event.MOUSE_LEAVE, desativar)
			stage.quality = StageQuality.LOW
		}
		
	}
	
}

//package  
//{
   /**
    * ...
    * @author Thi
    */
   /*public*/ class Part
   {
      
      public var x:Number, y:Number
      public var next:Part, prev:Part
      
      public function Part(x:Number=0,y:Number=0) 
      {
         this.x = x
         this.y = y
      }
      
   }

//}

//package  
//{
   import flash.display.Graphics;
   import flash.display.Shape;
   import flash.events.Event;
   import flash.filters.GlowFilter;
   /**
    * ...
    * @author Thi
    */
   /*public*/ class Folow extends Shape
   {
      
      private var PARTS:Array
      public var num:int
      
      public function Folow(num:int=2) 
      {
         this.num = num
         //
         addEventListener(Event.ADDED_TO_STAGE, added)
         
      }
      
      private function added(e:Event = null):void
      {
         removeEventListener(Event.ADDED_TO_STAGE, added)
         addEventListener(Event.REMOVED_FROM_STAGE, removed)
         //
         init()
         //
         addEventListener(Event.ENTER_FRAME, ef)
      }
      
      private function removed(e:Event = null):void
      {
         removeEventListener(Event.REMOVED_FROM_STAGE, removed)
         addEventListener(Event.ADDED_TO_STAGE, added)
         //
         removeEventListener(Event.ENTER_FRAME, ef)
      }
      
      private var i:int
      
      private function init():void
      {
         PARTS = null
         PARTS = new Array(num)
         
         PARTS[0] = new Part()
         
         while (++i < num)
         {
            trace(i)
            PARTS[i] = new Part()
            PARTS[i].prev = PARTS[i-1]
            PARTS[i-1].next = PARTS[i]
         }
         
         g = graphics
         this.filters = [GLOW]
      }
      
      private var GLOW:GlowFilter = new GlowFilter(0x40FFFF,1,4,4,2,1)
      
      private var p:Part
      private var g:Graphics
      
      private function ef(e:Event = null):void
      {
         g.clear()
         g.lineStyle(1, 0)
         
         p = PARTS[0]
         g.moveTo((p.x += (mouseX - p.x) * .2), (p.y += (mouseY - p.y) * .2))
         
         while ((p = p.next) != null)
         {
            g.lineStyle(Math.random()*3, 0)
            g.lineTo((p.x += (p.prev.x - p.x) * .8),(p.y += (p.prev.y - p.y) * .8))
         }
         
         
      }
      
      
      
   }

//}