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 2009-6-24

Get Adobe Flash player
by set0 24 Jun 2009
/**
 * Copyright set0 ( http://wonderfl.net/user/set0 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/rUX6
 */

package 
{
    import flash.display.*;
    import flash.events.*;
   
    [SWF(width=465, height=465, frameRate=60, backgroundColor=0x000000)]
    public class FlashTest3d03 extends Sprite
    {
        private var sp_list:Array = [];
		private var center_x:Number = stage.stageWidth / 2;
        private var center_y:Number = stage.stageHeight / 2;
		private var flag:Boolean = true;
       
        public function FlashTest3d03()
        {
            Wonderfl.capture_delay(15);
			addEventListener(Event.ENTER_FRAME, onEnterFrame);
        }
       
        private function onEnterFrame(e:Event):void
        {
			sp_list.push(new Plus(center_x, center_y, flag));
			flag = !flag;
			
			var max:int = sp_list.length;
			addChild(sp_list[max - 1]);
			setChildIndex(sp_list[max - 1], 0);
			
            for (var i:int = 0; i < max; i++) {
                if (sp_list[i].move(stage.mouseX, stage.mouseY) == false) {
					removeChild(sp_list[i]);
					sp_list.splice(i, 1);
					i--;
					max--;
					continue;
                }
            }
        }
    }
}

import flash.display.*;

class Plus extends Sprite
{
	public var _z:Number = 3000;
	public var init_x:Number;
	public var init_y:Number;
	public var center_x:Number;
	public var center_y:Number;
	public var fl:Number = 100;
	public var flag:int = 0;
	
	public function Plus(x:Number, y:Number, flag:Boolean) 
	{
		this.x = -100;
		this.y = -100;
		this.init_x = -100;
		this.init_y = -100;
		this.center_x = x;
		this.center_y = y;
		this.flag = int(flag);
		
		var color:uint = 0xffffff * Math.random();

		graphics.lineStyle(8, color, 1, false, "normal", CapsStyle.SQUARE);
		graphics.moveTo(10, 0);
		graphics.lineTo(10, 20);
		graphics.moveTo(0, 10);
		graphics.lineTo(20, 10);
	}
	
	public function move(x:Number, y:Number):Boolean
	{
		this._z -= 5;
		
		if (this._z < 0 ) {
			return false;
		}
		
		moveMouse(x, y);
		return true;		
	}
	
	public function moveMouse(x:Number, y:Number):void
	{
		var scale:Number = this.fl / (this.fl + this._z);
		
		this.init_x = Math.cos((this._z + 180 * flag) * Math.PI / 180) * 400;
		this.init_y = Math.sin((this._z + 180 * flag) * Math.PI / 180) * 400;
		
		this.init_x += (this.center_x - x) * 5;
		this.init_y += (this.center_y - y) * 5;
		
		this.x = this.init_x * scale + this.center_x;
		this.y = this.init_y * scale + this.center_y;
		
		this.scaleX = scale;
		this.scaleY = scale;
	}
}