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

集中して、息をとめて撃てっ! forked from: Checkmate vol.5 Professenal

@OKASUKE
*β版なので7匹まで、14匹はお手軽さがないなぁ。。。
*iPhoneに移植できそうなタッチ&リリース
*10/22バグ修正中・・・注:まだバグあります。
*10/23完成予定・・・バグはなくなったかと。。。ソースは汚いが・・・
*
*参考 betweenas3Demo beinteractiveさんhttp://wonderfl.net/code/6c19a0f54ef69d3095743b293e55ce3e93e8b3c6
*背景 paqさんhttp://wonderfl.net/code/8a1d2f7fd87a599f525166c8d5380fa04864dff0
*説明:マウスダウンでリロード画面上に
*「リロード完了 The loading is completed.」メッセージ表示で射撃可能
* ドラッグでスコープ移動し、ワンコを狙って撃てっ!
Get Adobe Flash player
by OKASUKE 05 Jan 2010
/**
 * Copyright OKASUKE ( http://wonderfl.net/user/OKASUKE )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/3MV2
 */

/*@OKASUKE
*β版なので7匹まで、14匹はお手軽さがないなぁ。。。
*iPhoneに移植できそうなタッチ&リリース
*10/22バグ修正中・・・注:まだバグあります。
*10/23完成予定・・・バグはなくなったかと。。。ソースは汚いが・・・
*
*参考 betweenas3Demo beinteractiveさんhttp://wonderfl.net/code/6c19a0f54ef69d3095743b293e55ce3e93e8b3c6
*背景 paqさんhttp://wonderfl.net/code/8a1d2f7fd87a599f525166c8d5380fa04864dff0
*説明:マウスダウンでリロード画面上に
*「リロード完了 The loading is completed.」メッセージ表示で射撃可能
* ドラッグでスコープ移動し、ワンコを狙って撃てっ!
*/

// forked from checkmate's Checkmate vol.5 Professenal
package {
	import adobe.utils.CustomActions;	
	import caurina.transitions.properties.TextShortcuts;
	import flash.display.*;
	import flash.events.*;
	import flash.geom.Point;
	import flash.utils.*;
	import flash.net.*;
	import flash.system.*;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	import flash.filters.BlurFilter;	
	
	import jp.progression.commands.*;
	import jp.progression.commands.lists.*;
	import jp.progression.commands.display.*;
	import jp.progression.commands.net.*;
	import jp.progression.commands.tweens.*;
	import jp.progression.events.*;
		
	//import caurina.transitions.*;	
	import org.libspark.betweenas3.*;
	import org.libspark.betweenas3.tweens.ITween;
	import org.libspark.betweenas3.easing.*;
	import org.libspark.betweenas3.tweens.ITweenGroup;
	import frocessing.shape.FShapeSVG;
    
	public class Professional extends Sprite {
		public static var GRAPHICS_URL:String = "http://swf.wonderfl.net/static/assets/checkmate05/wancoProfessional.swf";
		private static var ZOOMSCOOP:Number = 2;
		private static var LEVELGAME:Number = 60; //小さいほど難易度が高い
		
		public var stayMotion:MovieClip;
		public var jumpMotion:MovieClip;
		public var highJumpMotion:MovieClip;
		public var walkMotion:MovieClip;
		public var runMotion:MovieClip;
		public var squatMotion:MovieClip;
		public var questionMotion:MovieClip;
		public var exclamationMotion:MovieClip;
		public var heartMotion:MovieClip;
		public var poutMotion:MovieClip;
		public var starMotion:MovieClip;
		public var singMotion:MovieClip;
		public var sleepMotion:MovieClip;
		public var wakeMotion:MovieClip;	
		
		private var _downFlg:Boolean = false;		
		
		private var motionList:Array;
		private var _wankoNo:Number = 0;
		
		private var _staytween:ITween;
		private var _jumptween:ITween;
		private var _highJumptween:ITween;		
		private var _walktween:ITween;
		private var _runtween:ITween;		
		private var _squattween:ITween;
		private var _questiontween:ITween;		
		private var _exclamationtween:ITween;
		private var _heartween:ITween;
		private var _pouttween:ITween;
		private var _startiontween:ITween;		
		private var _singtween:ITween;
		private var _sleeptween:ITween;
		private var _waketween:ITween;
		
		private var _tweenList:Array;
		//private var _tweenList:Vector = new Vector.<ITween>();
		//http://74.125.153.132/search?q=cache:QG1EhC0d4ywJ:www.project-nya.jp/
		//modules/weblog/details.php%3Fblog_id%3D1169+BetweenAs3+serialTweens&cd=8&hl=ja&ct=clnk&gl=jp
		//private var _tweenGroup:ITweenGroup;		
		private var _tweenFlg:Boolean = false;
		
		
		private var _scoreText:TextField = new TextField();
		private var _scoreNumber:Number = 0;
		private var _blur:BlurFilter;
		
		public function Professional (){
			super();
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;			
			
			//背景
			var backgra:BitmapData = new BitmapData(465, 465, false, 0x000000);
            var bmpback : Bitmap = new Bitmap(backgra);
            addChild(bmpback);
			
			for (var i:int = 0; i < 777; i++) {
				var star:Sprite = new Sprite();
				star.graphics.beginFill(0xFFFFFF, Math.random());
				star.graphics.drawCircle(Math.random() * 465, Math.random() * 465, 1);
				star.graphics.endFill();
				addChild(star);
			}
				
			var com:SerialList = new SerialList();
			com.addCommand(
				new LoadSWF( new URLRequest( GRAPHICS_URL ) ),
				function():void {
					var loader:Loader = Loader( this.latestData );
					var domain:ApplicationDomain = loader.contentLoaderInfo.applicationDomain;
					
					stayMotion = new ( domain.getDefinition( "StayMotion" ) as Class );
					jumpMotion = new ( domain.getDefinition( "JumpMotion" ) as Class );
					highJumpMotion = new ( domain.getDefinition( "HighJumpMotion" ) as Class );
					walkMotion = new ( domain.getDefinition( "WalkMotion" ) as Class );
					runMotion = new ( domain.getDefinition( "RunMotion" ) as Class );
					squatMotion = new ( domain.getDefinition( "SquatMotion" ) as Class );
					questionMotion = new ( domain.getDefinition( "QuestionMotion" ) as Class );
					exclamationMotion = new ( domain.getDefinition( "ExclamationMotion" ) as Class );
					heartMotion = new ( domain.getDefinition( "HeartMotion" ) as Class );
					poutMotion = new ( domain.getDefinition( "PoutMotion" ) as Class );
					starMotion = new ( domain.getDefinition( "StarMotion" ) as Class );
					singMotion = new ( domain.getDefinition( "SingMotion" ) as Class );
					sleepMotion = new ( domain.getDefinition( "SleepMotion" ) as Class );
					wakeMotion = new ( domain.getDefinition( "WakeMotion" ) as Class );
				}
			);
			com.addEventListener(ExecuteEvent.EXECUTE_COMPLETE,onLoadSWF);
			com.execute();			
		}
		
		//private var tw1:ITween;
		private function onLoadSWF(e:Event):void {
				
			motionList = [
				stayMotion,
				jumpMotion,
				highJumpMotion,
				walkMotion,
				runMotion,
				heartMotion,
				starMotion,
				//ここまで
				squatMotion,
				questionMotion,
				exclamationMotion,				
				poutMotion,				
				singMotion,
				sleepMotion,
				wakeMotion					
			];
			
			var hNum:int = 4;
			var cnt:int = 0;
			for each( var motion:MovieClip in motionList ) {
				addChild(motion);				
				motion.x = cnt%hNum * 112 + 70;
				motion.y = Math.floor(cnt/hNum) * 112  + 80;
				//trace(motion.width);
				//trace(motion.height);
				motion.gotoAndStop(1);
				
				motion.addEventListener( MouseEvent.CLICK, clickHandler );
				motion.buttonMode = motion.useHandCursor = true;
				 
				cnt++;
			}			
			
			//背景
			var svg:XML = <svg><g>    <path fill="#FFFFFF" d="M495.498,20.332c-13.752,0-28.352-9.762-33.87-19.307c-5.693,9.545-20.712,19.307-34.463,19.307        s-28.353-9.762-33.87-19.307c-5.693,9.545-20.711,19.307-34.463,19.307s-28.352-9.762-33.87-19.307        c-5.693,9.545-20.712,19.307-34.463,19.307s-28.353-9.762-33.87-19.307c-5.693,9.545-20.711,19.307-34.463,19.307        s-28.352-9.762-33.87-19.307c-5.693,9.545-20.712,19.307-34.463,19.307c-14.178,0-29.264-10.375-34.362-20.193        C114.207,9.957,98.678,20.332,84.5,20.332C70.255,20.332,55.097,9.859,50.069,0h-0.196c-5.189,9.859-20.795,20.332-35.04,20.332        c-4.99,0-10.092-1.289-14.833-3.383V56h531V0h-0.462C525.349,9.859,509.743,20.332,495.498,20.332z"/></g></svg>
            var fshape:FShapeSVG = new FShapeSVG(svg);
            var whitewave:Sprite = addChild(fshape.toSprite()) as Sprite;
            whitewave.x = -34
            whitewave.y = 410
            var t:ITween = BetweenAS3.serial(
                BetweenAS3.tween(whitewave, { y: 420 }, null, 3.0 , Cubic.easeInOut),
                BetweenAS3.tween(whitewave, { y: 400 }, null, 3.0 , Cubic.easeInOut),
                BetweenAS3.tween(whitewave, { y: 410 }, null, 3.0 , Cubic.easeInOut)
            );
            t.stopOnComplete = false;
            t.play();
            
            svg = <svg><g>    <path fill="#00BFFF" d="M495.498,20.332c-13.752,0-28.352-9.762-33.87-19.307c-5.693,9.545-20.712,19.307-34.463,19.307        s-28.353-9.762-33.87-19.307c-5.693,9.545-20.711,19.307-34.463,19.307s-28.352-9.762-33.87-19.307        c-5.693,9.545-20.712,19.307-34.463,19.307s-28.353-9.762-33.87-19.307c-5.693,9.545-20.711,19.307-34.463,19.307        s-28.352-9.762-33.87-19.307c-5.693,9.545-20.712,19.307-34.463,19.307c-14.178,0-29.264-10.375-34.362-20.193        C114.207,9.957,98.678,20.332,84.5,20.332C70.255,20.332,55.097,9.859,50.069,0h-0.196c-5.189,9.859-20.795,20.332-35.04,20.332        c-4.99,0-10.092-1.289-14.833-3.383V56h531V0h-0.462C525.349,9.859,509.743,20.332,495.498,20.332z"/></g></svg>
            fshape = new FShapeSVG(svg);
            var wave:Sprite = addChild(fshape.toSprite()) as Sprite;
            wave.y = 410
            t = BetweenAS3.serial(
                BetweenAS3.tween(wave, { y: 420 }, null, 5.0 , Cubic.easeInOut),
                BetweenAS3.tween(wave, { y: 435 }, null, 5.0 , Cubic.easeInOut),
                BetweenAS3.tween(wave, { y: 410 }, null, 5.0 , Cubic.easeInOut)
            );
            t.stopOnComplete = false;
            t.play();
			
			//
			_shotText1.textColor = 0xffffff;
			_shotText1.autoSize = "left";
			_shotText1.x = 150;
			addChild(_shotText1);
			setCircle();
				
			//配列にITweenを入れる。
			_tweenList = [_staytween, _jumptween, _highJumptween, _walktween, _runtween, _heartween, _sleeptween];
			
			//Score配置
			_scoreText.textColor = 0xffffff;
			_scoreText.text = "Score: " + _scoreNumber + "ワンコ"
			addChild(_scoreText);
			
			var textf:TextFormat = new TextFormat();
				
			var kaisetuText1:TextField = new TextField();
			kaisetuText1.text = "マウスダウンでリロード、ドラッグで狙い、マウスアップでショット";
			kaisetuText1.autoSize = "left";
			kaisetuText1.selectable = false;
			addChild(kaisetuText1);
			kaisetuText1.y = 430;
			
			var kaisetuText2:TextField = new TextField();
			kaisetuText2.text = "スコープをワンコにあわせて撃て!";
			kaisetuText2.autoSize = "left";			
			kaisetuText2.selectable = false;
			addChild(kaisetuText2);
			kaisetuText2.y = 446;
			
			/*var lpList:LoopList = new LoopList(0, null,
				function():void {
					trace("a");
					for each( var motion:MovieClip in motionList ) {
						//motion.wc2.wc3.gotoAndPlay(2);						
					}
				}				
			);
			lpList.execute();*/
			
			Stageout();
		}		
		
		//元の位置
		//x70y80 x182y80 x294y80 x406y80
		//x70y192 x182y192 x294y192 x406y192
		//x70y304 x182y304 x294y304 x406y304
		//x70y416 x182y416
		//到達xx座標 yy座標0~13
		private var tx1:Array = [70, 182, 294, 406,  70, 182, 294, 406,  70, 182, 294, 406,  70, 182];
		private var ty1:Array = [80,  80,  80,  80, 192, 192, 192, 192, 304, 304, 304, 304, 416, 416];
		private var xx:Array = [-100,  182,  294,  565, -100,  182,  294,  406, -100,  182,  294,  406, -100,  182]; 
		private var yy:Array = [-100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100];
		//ベジェ座標															 //10
		private var xx1:Array = [50,  100, 150, 250, 100, 200, 100, 400, 280, 320, 380, 400, 60, 80];
		private var xx2:Array = [100, 200, 300, 400, 200, 300, 200, 100,  80, 120, 120, 150,  90, 120];
		private var xx3:Array = [200, 300, 400, 100, 300, 400, 300, 200, 120, 160, 150, 180, 160, 180];
		private var xx4:Array = [40,  80,  160, 300,  80, 160, 100, 400, 350, 350, 350, 350, 350, 350];
		private var yy1:Array = [40,  80,  160, 320,  80, 320, 100,  50, 150, 200, 160, 220, 160, 200];
		private var yy2:Array = [100, 200, 300, 400, 200, 400, 200, 100, 160, 190, 220, 260, 190, 230];
		private var yy3:Array = [200, 400, 100, 200, 300, 300, 300, 200, 210, 250, 270, 320, 260, 300];
		private var yy4:Array = [400, 100, 200, 300, 100, 400, 100, 400, 280, 320, 380, 400, 320, 350];
		
		//一旦ステージの外に
		private function Stageout():void {
			
			var count:int = 0;
			for each( var motion:MovieClip in motionList ) {				
				
				var _t:ITween = BetweenAS3.bezier(motion,
					{x:xx[count], y:yy[count] }, //to
					{x:tx1[count], y:ty1[count], scaleX:0.5, scaleY:0.5 }, //from
					{
						x:[xx1[count], xx2[count], xx3[count], xx4[count]],								
						y:[yy1[count], yy2[count], yy3[count], yy4[count]]
						//x: [58.05, 145.9, 246.7, 345.55],
						//y: [61.4, 80.65, 167.05, 209.3]
					}, //control points
					3.0,  //time
					Cubic.easeOut //easing
				);				
				_t.stopOnComplete = true;
				_t.play();
				
				count++;					
			}
			//とりあえずタイマー
			var timerOut1:Timer = new Timer(5000, 1);
			timerOut1.addEventListener(TimerEvent.TIMER_COMPLETE, StageGoNo1);
			timerOut1.start();
		}
			
		private var ixx1:Array = [25,  180,  80, 100,  30,  60, 130, 110,  40,  80, 100, 120,  60,  80];
		private var ixx2:Array = [50,  240, 100, 150,  80,  90, 210, 180,  80, 120, 120, 150,  90, 120];
		private var ixx3:Array = [80,  70, 130, 160, 120, 120, 230, 210, 120, 160, 150, 180, 160, 180];
		private var ixx4:Array = [150, 150, 300, 350, 350, 350, 320, 350, 350, 350, 350, 350, 350, 350];
		private var iyy1:Array = [50,   70, 100, 150, 100, 120, 90, 180, 150, 200, 160, 220, 160, 200];
		private var iyy2:Array = [120, 150, 200, 250, 130, 180, 130, 240, 160, 190, 220, 260, 190, 230];
		private var iyy3:Array = [200, 180, 240, 300, 180, 220, 160, 300, 210, 250, 270, 320, 260, 300];
		private var iyy4:Array = [300, 240, 300, 350, 240, 290, 350, 350, 280, 320, 380, 400, 320, 350];
			
		//ワンコがステージの中にINその1 ここ絶対無駄な書き方を繰り返してる。*****************
		//いろいろモーションをためしてたらコードが冗長に・・・ごめんなさい
		private function StageGoNo1(e:TimerEvent):void {
			var count:int = 0;
			_wankoNo++;
			
			_staytween = BetweenAS3.bezier(stayMotion,
			{x:570, y:230, scaleX:1, scaleY:1 }, //to
			{x:-100, y:-100, scaleX:0.1, scaleY:0.1 }, //from
				{
					x:[ixx1[count], ixx2[count], ixx3[count], ixx4[count]],								
					y:[iyy1[count], iyy2[count], iyy3[count], iyy4[count]]						
				}, //control points
				3.0,  //time
				Cubic.easeOut //easing
			);				
			_staytween.stopOnComplete = true;
			_staytween.play();			
			
			_tweenList[0] = _staytween;
			//_tweenList.push(_staytween);			
			
			_staytween.addEventListener(Event.COMPLETE, StageGoNo2);
		}		
		
		//ワンコがステージにINその2
		private function StageGoNo2(e:*):void {
			_jumptween = BetweenAS3.bezier(jumpMotion,
			{x:-100, y:400, scaleX:1, scaleY:1 }, //to
			{x:-565, y:-100, scaleX:0.1, scaleY:0.1 }, //from
				{
					x:[ixx1[_wankoNo], ixx2[_wankoNo], ixx3[_wankoNo], ixx4[_wankoNo]],								
					y:[iyy1[_wankoNo], iyy2[_wankoNo], iyy3[_wankoNo], iyy4[_wankoNo]]						
				}, //control points
				3.0,  //time
				Cubic.easeOut //easing
			);				
			_jumptween.stopOnComplete = true;
			_jumptween.play();
			_wankoNo++;
			
			_tweenList[1] = _jumptween;
			
			_jumptween.addEventListener(Event.COMPLETE, StageGoNo3);
		}
		//ワンコがステージにINその3
		private function StageGoNo3(e:*):void {
			_highJumptween = BetweenAS3.bezier(highJumpMotion,
			{x:230, y:-100, scaleX:1.0, scaleY:1.0 }, //to
			{x:230, y:-100, scaleX:0.1, scaleY:0.1 }, //from
				{
					x:[ixx1[_wankoNo], ixx2[_wankoNo], ixx3[_wankoNo], ixx4[_wankoNo]],								
					y:[iyy1[_wankoNo], iyy2[_wankoNo], iyy3[_wankoNo], iyy4[_wankoNo]]						
				}, //control points
				3.0,  //time
				Cubic.easeOut //easing
			);				
			_highJumptween.stopOnComplete = true;
			_highJumptween.play();
			_wankoNo++;
			
			_tweenList[2] = _highJumptween;
			
			_highJumptween.addEventListener(Event.COMPLETE, StageGoNo4);
		}
		
		//ワンコがステージにINその4
		private function StageGoNo4(e:*):void {
			_walktween = BetweenAS3.bezier(walkMotion,
			{x:570, y:230, scaleX:1, scaleY:1 }, //to
			{x:-100, y:230, scaleX:0.1, scaleY:0.1 }, //from
				{
					x:[ixx1[_wankoNo], ixx2[_wankoNo], ixx3[_wankoNo], ixx4[_wankoNo]],								
					y:[iyy1[_wankoNo], iyy2[_wankoNo], iyy3[_wankoNo], iyy4[_wankoNo]]						
				}, //control points
				3.0,  //time
				Cubic.easeOut //easing
			);				
			_walktween.stopOnComplete = true;
			_walktween.play();
			_wankoNo++;
			
			_tweenList[3] = _walktween;
			
			_walktween.addEventListener(Event.COMPLETE, StageGoNo5);
		}
		
		//ワンコがステージにINその5
		private function StageGoNo5(e:*):void {
			_runtween = BetweenAS3.bezier(runMotion,
			{x:570, y:130, scaleX:0.8, scaleY:0.8 }, //to
			{x:-100, y:230, scaleX:0.1, scaleY:0.1 }, //from
				{
					x:[ixx1[_wankoNo], ixx2[_wankoNo], ixx3[_wankoNo], ixx4[_wankoNo]],								
					y:[iyy1[_wankoNo], iyy2[_wankoNo], iyy3[_wankoNo], iyy4[_wankoNo]]						
				}, //control points
				2.6,  //time
				Cubic.easeOut //easing
			);				
			_runtween.stopOnComplete = true;
			_runtween.play();
			_wankoNo++;
			
			_tweenList[4] = _runtween;
			
			_runtween.addEventListener(Event.COMPLETE, StageGoNo6);
		}
		
		//ワンコがステージにINその6
		private function StageGoNo6(e:*):void {
			_heartween = BetweenAS3.bezier(heartMotion,
			{x:570, y:200, scaleX:1, scaleY:1 }, //to
			{x:570, y:230, scaleX:0.1, scaleY:0.1 }, //from
				{
					x:[ixx1[_wankoNo], ixx2[_wankoNo], ixx3[_wankoNo], ixx4[_wankoNo]],								
					y:[iyy1[_wankoNo], iyy2[_wankoNo], iyy3[_wankoNo], iyy4[_wankoNo]]						
				}, //control points
				2.6,  //time
				Cubic.easeOut //easing
			);				
			_heartween.stopOnComplete = true;
			_heartween.play();
			_wankoNo++;
			
			_tweenList[5] = _heartween;
			
			_heartween.addEventListener(Event.COMPLETE, StageGoNo7);
		}
		
		//ワンコがステージにINその7
		private function StageGoNo7(e:*):void {
			_sleeptween = BetweenAS3.bezier(starMotion,
			{x:570, y:100, scaleX:1, scaleY:1 }, //to
			{x:-100, y:-100, scaleX:0.1, scaleY:0.1 }, //from
				{
					x:[ixx1[_wankoNo], ixx2[_wankoNo], ixx3[_wankoNo], ixx4[_wankoNo]],								
					y:[iyy1[_wankoNo], iyy2[_wankoNo], iyy3[_wankoNo], iyy4[_wankoNo]]						
				}, //control points
				1.2,  //time
				Cubic.easeOut //easing
			);				
			_sleeptween.stopOnComplete = true;
			_sleeptween.play();
			_wankoNo++;
			
			_tweenList[6] = _sleeptween;
			
			_sleeptween.addEventListener(Event.COMPLETE, endMessage);
		}
		
		//ここまでワンコ1ステージIN************************************************************************
		private var _shotText1:TextField = new TextField();
		//ENTERFRAME
		private function Frameloop(e:Event):void {
			
			
			
			if (_downFlg) {
				_circle.x += (stage.mouseX - _circle.x) / 10;
				_circle.y += (stage.mouseY - _circle.y) / 10;
				_circle.scaleX += (ZOOMSCOOP - _circle.scaleX) / 10;
				_circle.scaleY += (ZOOMSCOOP - _circle.scaleY) / 10;			
				
				//trace(_circle.scaleX);
				//trace(ZOOMSCOOP);
				stage.addEventListener(MouseEvent.MOUSE_UP, onshut);
				if (_circle.scaleX >= 1.95) {								
					_shotText1.text = "リロード完了 The loading is completed."
				}
				
			} else {
				_shotText1.text = " ";
				var t2:ITween = BetweenAS3.tween(_circle,
					{scaleX:1, scaleY:1},
					null, 1, Linear.easeIn);
					t2.stopOnComplete = true;
					t2.play();
				
			}			
			stage.addEventListener(MouseEvent.MOUSE_DOWN, reload);				
		}
		
		
		private var _circle:Sprite; 
		//スコープ
		private function setCircle():void {
			var xline:Sprite = new Sprite;
			var yline:Sprite = new Sprite;
			
			xline.graphics.beginFill(1, 1);
			xline.graphics.lineStyle(1, 0x009900);
			xline.graphics.moveTo(-30, 0);
			xline.graphics.lineTo(30, 0);
			xline.graphics.endFill();
			
			yline.graphics.beginFill(0, 1);
			yline.graphics.lineStyle(1, 0x009900);
			yline.graphics.moveTo(0, -30);
			yline.graphics.lineTo(0, 30);
			yline.graphics.endFill();
			
			_circle = new Sprite();
			_circle.graphics.beginFill(0xffffff, 0.2);
			_circle.graphics.lineStyle(1, 0x009900);
			_circle.graphics.drawCircle(0, 0, 30);
			_circle.graphics.endFill();
			addChild(_circle);
			_circle.addChild(xline);
			_circle.addChild(yline);
			
			_circle.x = 230;
			_circle.y = 230;
			stage.addEventListener(Event.ENTER_FRAME, Frameloop);
			//stage.addEventListener(MouseEvent.MOUSE_MOVE, scopmove);
		}
		
		//リロード
		private function reload(e:Event):void {
			//trace("reload");
			_downFlg = true;
			//リロードで揺れとめ
			//_circle.removeEventListener(Event.ENTER_FRAME, circleYure);
			//addEventListener(MouseEvent.MOUSE_MOVE, scopmove);
		}
		
		//スコープ移動マウスで
		private function scopmove(e:Event):void {}
		
		//マウスアップで撃つ!
		private function onshut(e:Event):void {
			//trace("up");
			trace(_wankoNo);
			_downFlg = false;
			if (_circle.scaleX <= 1.95) return;
			stage.removeEventListener(MouseEvent.MOUSE_UP, onshut);
			//removeEventListener(MouseEvent.MOUSE_MOVE, scopmove);			
			//stage.removeEventListener(MouseEvent.MOUSE_DOWN, reload);			
			
			//trace(_tweenList[_wankoNo-1]);
			
			if (_wankoNo == 0) return; 
			if (_wankoNo >= 8) return;
			
			
			P2distance(motionList[_wankoNo-1], _tweenList[_wankoNo-1]);
			
			scopeyure();	
			
			switch(_wankoNo) {
				
				case 1:
					//とりあえずタイマー					
					var timerOut2:Timer = new Timer(3000, 1);
					timerOut2.addEventListener(TimerEvent.TIMER_COMPLETE, StageGoNo2);
					timerOut2.start();
					_staytween.removeEventListener(Event.COMPLETE, StageGoNo2);
					break;
				case 2:
					//_staytween.removeEventListener(Event.COMPLETE, StageGoNo2);
					timerOut2 = new Timer(3000, 1);
					timerOut2.addEventListener(TimerEvent.TIMER_COMPLETE, StageGoNo3);
					timerOut2.start();
					_jumptween.removeEventListener(Event.COMPLETE, StageGoNo3);
					break;
				case 3:
					//_jumptween.removeEventListener(Event.COMPLETE, StageGoNo3);
					timerOut2 = new Timer(3000, 1);
					timerOut2.addEventListener(TimerEvent.TIMER_COMPLETE, StageGoNo4);
					timerOut2.start();
					_highJumptween.removeEventListener(Event.COMPLETE, StageGoNo4);
					break;
				case 4:
					//_highJumptween.removeEventListener(Event.COMPLETE, StageGoNo4);
					timerOut2 = new Timer(3000, 1);
					timerOut2.addEventListener(TimerEvent.TIMER_COMPLETE, StageGoNo5);
					timerOut2.start();
					_walktween.removeEventListener(Event.COMPLETE, StageGoNo5);
					break;
				case 5:
					//_walktween.removeEventListener(Event.COMPLETE, StageGoNo5);
					timerOut2 = new Timer(3000, 1);
					timerOut2.addEventListener(TimerEvent.TIMER_COMPLETE, StageGoNo6);
					timerOut2.start();
					_runtween.removeEventListener(Event.COMPLETE, StageGoNo6);
					break;
				case 6:
					//_runtween.removeEventListener(Event.COMPLETE, StageGoNo6);
					timerOut2 = new Timer(3000, 1);
					timerOut2.addEventListener(TimerEvent.TIMER_COMPLETE, StageGoNo7);
					timerOut2.start();
					//_sleeptween.addEventListener(Event.COMPLETE, endMessage);
					break;
				case 7:
					//β版なので7体まで
					endMessage(null);
					break;
				case 8:
					break;
				case 9:
					break;
				case 10:
					break;
				case 11:
					break;
				case 12:
					break;
				case 13:
					break;
				case 14:
					break;
				default:
					break;			
			}
		}
		
		//スコープが振動させるか? やめだやめっ!
		private function scopeyure():void {
			//_circle.addEventListener(Event.ENTER_FRAME, circleYure);	
		}
		
		private var _nRadian:Number = 0;
		private function circleYure(e:Event):void {
			_circle.x = _circle.x + Math.cos(_nRadian) * 1;
			_circle.y = _circle.y + Math.sin(_nRadian) * 1;
			_nRadian += 0.5;		
		}
			
		private var distance:Number = 0;
		//ワンコとスコープの中心の距離を測る
		private function P2distance(motion:MovieClip, tween:ITween):void {
				
			//trace(motion);
			distance = Math.sqrt((_circle.x -  motion.x) * (_circle.x -  motion.x) + (_circle.y - motion.y) * (_circle.y - motion.y));
			//今は100以下であたったことにする。
			//trace(distance);
			if (distance <= LEVELGAME) {
				//	motion.y = 465;			

				tween.stop();
				
				ScorePlus();
				WankoKaiten(motion);					
			}
		}
		
		//ワンコの動きが止まったらアクション
		private function WankoDown(motion:MovieClip):void {
			WankoEffect(motion);
			//trace(motion);			
			var t1:ITween = BetweenAS3.tween(motion, {x:motion.x , y:(motion.y + 400)}, null, 2, Linear.easeInOut);
			t1.stopOnComplete = true;
			
			t1.play();
			
		}		
		
		//ワンコ回転させる
		private function WankoKaiten(motion:MovieClip):void {
			motion.gotoAndPlay(1);
			motion.wc2.wc3.gotoAndPlay(2);
			WankoDown(motion);
		}
		
		//private 
		//ワンコ落下エフェクト
		private function WankoEffect(motion:MovieClip):void {
			var _fire:Sprite = new Sprite();
			addChild(_fire);

			var bmpd:BitmapData;
			_blur = new BlurFilter(12, 12);
			
			for (var i:uint = 0; i < 1; i++) {
				var circle:Sprite = new Sprite();
				circle.graphics.beginFill(0x00ffff00, 0.4);
				circle.graphics.drawCircle(0, -20, 40);
				circle.graphics.endFill();				
				_fire.addChild(circle);
				
				circle.blendMode = BlendMode.HARDLIGHT;				
				circle.filters = [_blur];				
				
				var mask1:Sprite = new Sprite();
				mask1.graphics.beginFill(0x0000ff00, 1);
				mask1.graphics.drawCircle(0, -30, 40);
				mask1.graphics.endFill();
				
				_fire.addChild(mask1);
				addChild(_fire);				
				
				mask1.blendMode = BlendMode.ERASE;
				_fire.blendMode = BlendMode.LAYER;				
			}
			motion.addChild(_fire);				
		}
		
		//スコアアップ
		private function ScorePlus():void {
			_scoreNumber += 1;
			_scoreText.text = "Score: " + _scoreNumber + "ワンコ"
		}		
		
		//ゲーム終了メッセージ
		private function endMessage(e:Event):void {
			var endMessage:TextField = new TextField();
			endMessage.textColor = 0xffffff;
			endMessage.autoSize = "left";
			endMessage.selectable = false;
			endMessage.text = "終わりワン!!";
			addChild(endMessage);
			endMessage.x = 190;
			endMessage.y = 232;		
			
			var rank:TextField = new TextField();
			rank.textColor = 0xffffff;
			rank.autoSize = "left";
			rank.selectable = false;
			rank.text = _scoreNumber + "/7だワンダフル! " ;
			addChild(rank);
			rank.x = 190;
			rank.y = 250;
		}
			
		private function clickHandler(e:Event):void {
			//trace("1");
			var motion:MovieClip = e.currentTarget as MovieClip;
			//trace(e.currentTarget);
			motion.gotoAndPlay(1);
            // A way of rolling.
            motion.wc2.wc3.gotoAndPlay(2);
			//motion.gotoAndPlay(2);
		}		
	}
}