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

なかなか引っ張れない

ドラッグして引っ張ってください。
軽くイラっと来ますが了承下さい。
Get Adobe Flash player
by umroom 19 Feb 2010
    Embed
/**
 * Copyright umroom ( http://wonderfl.net/user/umroom )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/pr6R
 */

/*
ドラッグして引っ張ってください。
軽くイラっと来ますが了承下さい。
*/

package
{
	import flash.display.*;
	import flash.events.*;
	import flash.text.*;
	import gs.*;
	import gs.easing.*;
	[SWF(width="400", height="400", backgroundColor="0xFFFFFF", frameRate="30")]  

	
	public class Main extends MovieClip
	{
		
		private var _obj:MovieClip=new MovieClip();
		private var _startObjY:int;
		private var _startMouseY:int;
		private var _dY:Number;
		
		
		public function Main():void
		{
			addChild(_obj);
			
			initObj();
		}
		
		
		private function mDown(mEvt:MouseEvent):void
		{
			_startObjY = _obj.y;
			_startMouseY = stage.mouseY;
			addEventListener(Event.ENTER_FRAME, calc);
			stage.addEventListener(MouseEvent.MOUSE_UP, mUp);
		}
		
		
		private function mUp(mEvt:MouseEvent):void
		{
			removeEventListener(Event.ENTER_FRAME, calc);
			stage.removeEventListener(MouseEvent.MOUSE_UP, mUp);
		}
		
		
		private function calc(evt:Event):void
		{
			_dY = stage.mouseY-_startMouseY;
			if(_dY>0){	_dY *= 0.05;	}
			_obj.y = _startObjY + _dY;
			
			if(_obj.y > 145){	endPull();	}
		}
		
		
		private function endPull():void
		{
			_obj.removeEventListener( MouseEvent.MOUSE_DOWN, mDown);
			removeEventListener(Event.ENTER_FRAME, calc);
			stage.removeEventListener(MouseEvent.MOUSE_UP, mUp);
			
			TweenMax.to(_obj, 1, {y:600, ease:Elastic.easeOut} );
		}
		
		
		private function initObj():void
		{
			//_obj.y = 500;
			_obj.x = 200;
			_obj.buttonMode=true;
			_obj.graphics.beginFill(0xCCCCCC);
			_obj.graphics.moveTo( -10, 20 );
			_obj.graphics.lineTo( 10, 20 );
			_obj.graphics.lineTo( 10, -300 );
			_obj.graphics.lineTo( -10, -300 );
			_obj.graphics.endFill();
			
			_obj.graphics.lineStyle( 2, 0x333333 );
			_obj.graphics.moveTo( 0, 30 );
			_obj.graphics.lineTo( 0, 50 );
			_obj.graphics.moveTo( -10, 40 );
			_obj.graphics.lineTo( 0, 50 );
			_obj.graphics.lineTo( 10, 40 );
			
			
			var _format:TextFormat = new TextFormat();
			_format.size = 20;
			_format.font = "_ゴシック";
			_format.align = TextFormatAlign.CENTER;

			var _txt1:TextField = new TextField();
			_txt1.text = "( ´,_ゝ`)プッ\nお疲れ様です。何もありません。";
			_txt1.setTextFormat( _format );
			_txt1.width = 300;	_txt1.height = _txt1.textHeight+4;
			_txt1.x = -150;
			_txt1.y = -300-_txt1.height;
			_txt1.background = true;	_txt1.border=true;
			
			var _txt2:TextField = new TextField();
			_txt2.text = "もうちょい";
			_txt2.setTextFormat( _format );
			_txt2.width = 300;	_txt2.height = _txt2.textHeight+4;
			_txt2.x = -150;
			_txt2.y = -100 - _txt2.height;
			_txt2.background = true;	_txt2.border=true;
			
			var _txt3:TextField = new TextField();
			_txt3.text = "引け 引け";
			_txt3.setTextFormat( _format );
			_txt3.width = 300;	_txt3.height = _txt3.textHeight+4;
			_txt3.x = -150;
			_txt3.y = -10 - _txt3.height;
			_txt3.background = true;	_txt3.border=true;
			
			
			_obj.addChild( _txt1 );
			_obj.addChild( _txt2 );
			_obj.addChild( _txt3 );
			
			
			_obj.addEventListener( MouseEvent.MOUSE_DOWN, mDown);
		}
		
		
	}
	
}