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

OS X的なボタン

OS Xのアプリケーションウインドウの閉じるボタン等みたいなやつ
カラーパラメーターとか付けてみたかったけど
めんどくさかったので断念.
Get Adobe Flash player
by geko 13 May 2010
/**
 * Copyright geko ( http://wonderfl.net/user/geko )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/tfVj
 */

//OS Xのアプリケーションウインドウの閉じるボタン等みたいなやつ
//カラーパラメーターとか付けてみたかったけど
//めんどくさかったので断念.

package {
	import flash.display.Sprite;
	import flash.display.GradientType;
	import flash.geom.Matrix;

	public class FlashTest extends Sprite {
		public function FlashTest() {
			var matrix:Matrix = new Matrix();
			matrix.rotate(Math.PI/2);
			this.graphics.lineStyle(1,0x333333);
			this.graphics.beginGradientFill(GradientType.LINEAR,[0xeaeaca,0xb1a9a9,0x333333],[1,1,1],[140,155,255],matrix);
			this.graphics.drawRect(-10,stage.stageWidth/2-120,stage.stageWidth+20,250);
			this.graphics.endFill();
			
			var circle:球 = new 球();
			circle.x = circle.y = stage.stageWidth/2;
			addChild(circle);
		}
	}
}

import flash.display.Sprite;
import flash.display.GradientType;
import flash.filters.BlurFilter;
import flash.filters.GlowFilter;
import flash.geom.Matrix;
import flash.events.MouseEvent;

class 球 extends Sprite{
	public var circle:Sprite = new Sprite();
	public var reflect:Sprite = new Sprite();
	public var over:Sprite = new Sprite();
		
	public function 球(){
		
		var matrix:Matrix = new Matrix();
		matrix.rotate(Math.PI/2);
		//塗り
		circle.graphics.beginGradientFill(GradientType.LINEAR,[0xa91f1f,0xece141],[1,1],[80,150],matrix);
		circle.graphics.drawCircle(0,0,100);
		circle.graphics.endFill();
		addChild(circle);
		
		//反射
		reflect.graphics.beginFill(0xffffff,0.75);
		reflect.graphics.drawEllipse(-40,-92,80,30);
		reflect.graphics.endFill();
		addChild(reflect);
		
		//ロールオーバー
		over.graphics.beginFill(0x432222,0.8);
		over.graphics.moveTo(-60,-15);
		over.graphics.lineTo(60,-15);
		over.graphics.lineTo(60,15);
		over.graphics.lineTo(-60,15);
		over.graphics.lineTo(-60,-15);
		over.graphics.endFill();
		
		//効果
		var inner:GlowFilter = new GlowFilter(0xA13A23,0.75,16,16,2.4,5,true);
		var outer:GlowFilter = new GlowFilter(0x000000,0.75,5,5,1.3,3);
		var blurA:BlurFilter = new BlurFilter(6,6,2);
		var blurB:BlurFilter = new BlurFilter();
		circle.filters = [inner,outer];
		reflect.filters = [blurA];
		over.filters = [blurB];
		
		//イベントハンドラ
		this.addEventListener(MouseEvent.ROLL_OVER, mouseHandler);
		this.addEventListener(MouseEvent.ROLL_OUT, mouseHandler);	
	}

	public function mouseHandler(event:MouseEvent):void{
		switch(event.type){
			case MouseEvent.ROLL_OVER: addChildAt(over,1); break;
			case MouseEvent.ROLL_OUT: removeChild(over); break;
		}
	}
}