forked from: フォーカスが外れた際のステージのマウス座標

by kenta forked from フォーカスが外れた際のステージのマウス座標 (diff: 1)
flash領域外クリックやブラウザからフォーカスが外れたときの
stage.mouseX の値を見るテスト
♥0 | Line 31 | Modified 2009-09-26 00:36:18 | MIT License
play

ActionScript3 source code

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

// forked from cda244's フォーカスが外れた際のステージのマウス座標
/*
	flash領域外クリックやブラウザからフォーカスが外れたときの
	stage.mouseX の値を見るテスト
*/

package
{
	import flash.display.MovieClip;
	import flash.text.TextField;
	import flash.events.*;
	
	[SWF(width="400", height="300", backgroundColor="0xFFFFFF", frameRate="30")]
	
	public class Main extends MovieClip
	{
		
		private var _txt1, _txt2:TextField;
		
		public function Main():void
		{
			_txt1 = new TextField();
			_txt2 = new TextField();
			_txt1.width = _txt2.width = 200;
			_txt1.height = _txt2.height = 200;
			_txt2.x = 200;
			addChild(_txt1);
			addChild(_txt2);
			
			addEventListener(Event.ENTER_FRAME, en);
			stage.addEventListener(MouseEvent.MOUSE_MOVE, mv);
		}
		
		
		private function en(evt:Event):void
		{
			_txt1.text = "\nflash領域外でも反応する?\nENTER_FRAME\n\n mouseX "+stage.mouseX+"\n mouseY "+stage.mouseY;
		}
		
		private function mv(mEvt:MouseEvent):void
		{
			_txt2.text = "\nflash領域外でも反応する?\nMOUSE_MOVE\n\n mouseX"+stage.mouseX+"\n mouseY"+stage.mouseY;
		}
		
		
		
	}
	
}