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

no blend mode - forked from: BlendMode.LIGHTENのテスト

ブレンドモードの使用がちょっと重かったので。
 fork 元の趣旨から外れてますが…
/**
 * Copyright matacat ( http://wonderfl.net/user/matacat )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/aX6f
 */

// forked from okoi's BlendMode.LIGHTENのテスト

// ブレンドモードの使用がちょっと重かったので。
// fork 元の趣旨から外れてますが…

package 
{
	import flash.display.Sprite;
	import flash.events.Event;
	
	[SWF(backgroundColor="0x00000000", frameRate="60")]

	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
            
            var circleStage:Sprite = new Sprite();
            
			for ( var i:int = 0; i < 10; i++ )
			{
				var circle:Circle = new Circle(stage.stageWidth/2,stage.stageHeight/2);
				circleStage.addChild( circle );
			}
            
            addChild(circleStage);
		}
		
	}
	
}
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
import flash.display.Shape;
import flash.events.Event;
//	チェック用円描画クラス
class Circle extends Shape {
	
	private var moveX:Number = 0;
	private var moveY:Number = 0;
    private var edge:Shape;
	
	public function Circle(_x:int, _y:int) {
		super();
		
		this.x = _x;
		this.y = _y;
		
        edge = new Shape();
		edge.graphics.beginFill( 0x555555 );
		edge.graphics.drawCircle( 0, 0, 100 );
		edge.graphics.endFill();
		
		graphics.beginFill( 0xFFFFFF, 1 );
		graphics.drawCircle( 0, 0, 80 );
		graphics.endFill();
		
		moveX = Math.random() * 5 - 2.5;
		moveY = Math.random() * 5 - 2.5;
		
        addEventListener(Event.ADDED_TO_STAGE, function(e:Event):void {
            removeEventListener(Event.ADDED_TO_STAGE, arguments.callee);
            parent.addChildAt(edge, 0);
            addEventListener(Event.ENTER_FRAME, EnterFrame);
        });
	}
	
	//
	//	毎フレームテキトウに移動させる	
	//
	private function EnterFrame(event:Event):void {
		
		this.x += moveX;
		this.y += moveY;
        edge.x = x;
        edge.y = y;
		
		if ( this.x < 0 || this.x > stage.stageWidth ) moveX = -moveX;
		if ( this.y < 0 || this.y > stage.stageHeight ) moveY = -moveY;
	}
	
}