flash on 2010-4-23

by umhr
♥0 | Line 52 | Modified 2010-04-23 21:26:46 | MIT License
play

ActionScript3 source code

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

package{
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.events.MouseEvent;
	import flash.events.Event;
	public class Main extends Sprite{
		private var _maru:Sprite;
		private var _moon:Sprite;
		public function Main(){
			this.graphics.lineStyle(1,0xFF0000);
			this.graphics.moveTo(100,100);
			this.graphics.lineTo(400,100);
			this.graphics.lineTo(100,400);
			this.graphics.lineTo(200,50);
			
			_maru = new Sprite();
			_maru.graphics.beginFill(0xFF0000);
			_maru.graphics.drawCircle(200,200,50);
			_maru.graphics.endFill();
			_maru.x = 50;
			_maru.y = 150;
			this.addChild(_maru);
			
			var tf:TextField = new TextField();
			tf.text = "肉";
			tf.x = 150;
			tf.y = 200;
			_maru.addChild(tf);
			
			var btn:Sprite = new Sprite();
			btn.graphics.beginFill(0x0000FF);
			btn.graphics.drawCircle(50,50,30);
			btn.graphics.endFill();
			btn.buttonMode = true;
			btn.addEventListener(MouseEvent.CLICK,onClick);
			this.addChild(btn);
			
			_moon = new Sprite();
			_moon.graphics.beginFill(0xFFFF00);
			_moon.graphics.drawCircle(100,100,30);
			_moon.graphics.endFill();
			_moon.x = 200;
			_moon.y = 200;
			this.addChild(_moon);
			
			this.addEventListener(Event.ENTER_FRAME,onEnter);
			
			trace("hoge");
		}
		private function onClick(event:MouseEvent):void{
			trace("クリックされたよ。");
			_maru.x += 1;
		}
		private function onEnter(event:Event):void{
			_moon.rotation += 1;
		}
	}
}