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 Player 10、ここがすごい!

http://www.atmarkit.co.jp/fdotnet/vblab/silverlight3intro/silverlight3intro_04.html
* Silverlight 3、ここがすごい!
* の何がすごいのかFlaherな俺にはよく分からなかったので、
* ASで実現してみた。
* ActionScript3で出来ることが、Silverlightでも出来るんだね!
* Silverlight SUGEEEE!
* 
* すいません。ごめんなさい。
* by coppieee
Get Adobe Flash player
by coppieee 16 Jul 2009
/**
 * Copyright coppieee ( http://wonderfl.net/user/coppieee )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/izpc
 */

/**
 * http://www.atmarkit.co.jp/fdotnet/vblab/silverlight3intro/silverlight3intro_04.html
 * Silverlight 3、ここがすごい!
 * の何がすごいのかFlaherな俺にはよく分からなかったので、
 * ASで実現してみた。
 * ActionScript3で出来ることが、Silverlightでも出来るんだね!
 * Silverlight SUGEEEE!
 * 
 * すいません。ごめんなさい。
 * by coppieee
 */

package 
{
	import flash.display.GradientType;
	import flash.display.Graphics;
	import flash.display.SpreadMethod;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.geom.Matrix;
	import flash.text.TextField;
	
	public class Main extends Sprite 
	{
		private static const STAGE_SIZE:Number = 412;
		private static const SQUARE_SIZE:Number = 75;
		public function Main():void 
		{
			//Wonderfl.capture_delay( 3.2 );
			
			var speed:Number = 7;
			
			var gray:Sprite = createSquare(0x999999);
			gray.x = STAGE_SIZE/2;
			gray.y = 100;
			addChild(gray);
			
			var green:Sprite = createSquare(0x008800);
			green.x = STAGE_SIZE / 2;
			green.y = STAGE_SIZE / 2;
			addChild(green);
			
			var yellow:Sprite = createSquare(0xFFAA00);
			yellow.x = STAGE_SIZE / 2;
			yellow.y = STAGE_SIZE / 2;
			addChild(yellow);
			
			var red:Sprite = createSquare(0xFF0000);
			red.x = STAGE_SIZE / 2;
			red.y = STAGE_SIZE - 80;
			addChild(red);
			
			this.addEventListener(Event.ENTER_FRAME, function(e:Event):void {
				green.rotationX += 6;
				green.x += speed;
				red.rotationZ -= 10;
				red.z -= speed/2;
				yellow.rotationY += 6;
				yellow.y += speed;
				if (green.x > STAGE_SIZE && speed > 0)
				{
					speed = -speed;
				}else if (green.x < 0 && speed < 0)
				{
					speed = -speed;
				}
			});
		}
		private function createSquare(color:uint):Sprite
		{
			var s:Sprite = new Sprite();
			var g:Graphics = s.graphics;
			var m:Matrix = new Matrix(SQUARE_SIZE,0,0,SQUARE_SIZE);
			m.createGradientBox(SQUARE_SIZE, SQUARE_SIZE, Math.PI/180 * 45);
			g.beginGradientFill(GradientType.LINEAR, [color, 0xFFFFFF], [0.9, 0.9], [0x00, 0xFF],m);  
			g.drawRect(-SQUARE_SIZE/2,-SQUARE_SIZE/2,SQUARE_SIZE,SQUARE_SIZE);
			g.endFill();
			return s;
		}
	}
}