flash on 2010-1-7○をおくだけ

by otherone
♥0 | Line 41 | Modified 2010-03-30 14:58:01 | MIT License
play

ActionScript3 source code

/**
 * Copyright otherone ( http://wonderfl.net/user/otherone )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/cHLG
 */

package {
	import flash.display.Sprite;
	import flash.display.Graphics;
	import flash.events.MouseEvent;

	public class FlashTest extends Sprite {
		private var cir:DrawCircle=new DrawCircle;
		private var g:Graphics= cir.graphics;
		private var w:uint=stage.stageWidth;
		private var h:uint=stage.stageHeight;
		public function FlashTest() {
			// write as3 code here..
			circleSet();
			cir.addEventListener(MouseEvent.CLICK,fnClick);
		
		cir.buttonMode=true;
		}
		
		public function circleSet():void {
			//g.lineStyle(1, 0x000000, 1.0)
			g.beginFill(0xFFFFFF, 1.0);
			g.drawRect(0,0,w,h);
			for (var i:int=0; i<90; i++) {
				//cr,lw,tx,ty,tr,alp
				cir.drawCircle(ran(0xffff00),ran(30),ran(w),ran(h),ran(100),ran(100)+50);
				addChild(cir);
			}
		}
		
		public function fnClick(e:MouseEvent):void {
			g.clear();
			circleSet();
		}
		
		public function ran(range:Number):Number {
			var v:uint=Math.floor(Math.random() * range);
			return v;
		}
	}//end of class
}//end of package


import flash.display.Sprite;
class DrawCircle extends Sprite {
	function DrawCircle() {
	}
	function drawCircle(cr:int,lw:Number,tx:Number,ty:Number,tr:Number,alp:Number):void {
		//trace(tx)
		graphics.lineStyle(lw,cr,alp/100);
		graphics.drawCircle(tx,ty,tr);
	}
}