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

赤の習作2

Get Adobe Flash player
by chieinoue 25 Feb 2010
/**
 * Copyright chieinoue ( http://wonderfl.net/user/chieinoue )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/lZQU
 */

package {
    import flash.display.DisplayObject;
    import flash.display.Graphics;
    import flash.display.Shape;
    import flash.display.Sprite;
    import flash.events.*;
    import flash.text.TextField; 
       
    import flash.text.TextFormat;
    public class FlashTest extends Sprite {
    	
	
        public function FlashTest() {
		    var base:Sprite = new Sprite();
            base.graphics.beginFill(0xFFFFFF);
            base.graphics.drawRect(0, 0, 500, 500);
            base.graphics.endFill();
            addChild(base);
			
            var tf:TextField = new TextField();
            tf.autoSize = 'center';
			tf.text = 'CLICK ME!  ';
			var txtFmt:TextFormat = new TextFormat();
			txtFmt.font = 'Arial';
			txtFmt.size = 60;
			txtFmt.color = 0xDDDDDD;
			tf.setTextFormat(txtFmt);
			tf.x = 500 / 2 - tf.width / 2;
			tf.y = 500 / 2 - tf.height / 2;
            addChild(tf);
			
		    var catcher:Sprite = new Sprite();
            catcher.graphics.beginFill(0xFF0000,0.1);
            catcher.graphics.drawRect(0, 0, 500, 500);
            catcher.graphics.endFill();
            addChild(catcher);
			
			catcher.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void{
				tf.visible = false;
				var circle:Circle = new Circle();
				circle.x = event.localX;
				circle.y = event.localY;
				base.addChild(circle);
			});
		}
    }

}

import flash.display.Graphics;
import flash.display.Shape;
import flash.display.Sprite;
import com.flashdynamix.motion.*;

internal class Circle extends Sprite{

	public function Circle():void{
		var container:Sprite = new Sprite();		
		var child:Shape = new Shape();
		var halfSize:uint = Math.round((30 + Math.random() * 20) / 2);
		child.graphics.beginFill(getColor());
		child.graphics.drawCircle(halfSize, halfSize, halfSize);
		child.graphics.endFill();
		child.x = child.width / 2 * -1;
		child.y = child.height / 2 * -1;
		container.addChild(child);
		addChild(container);
		
		var duration:int = 5 + Math.floor(Math.random() * 5);
		var timeline:TweensyTimeline = Tweensy.to(container, {alpha:0}, duration-1);
		timeline.onComplete = function():void{
			removeChild(container);
		};
		Tweensy.to(container, {scaleX:12}, duration);
		Tweensy.to(container, {scaleY:12}, duration);
	}
	
	private function getColor():uint{
		var red:uint = 0x0000FF << 16;
		var green:uint = (Math.random()*0x000066) << 8;
		var blue:uint = Math.random()*0x0000CC;
		return red+green+blue;
	}
}