グローバル、ローカル座標

by 084
♥0 | Line 36 | Modified 2010-04-26 19:24:10 | MIT License
play

ActionScript3 source code

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

package {
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.text.TextField;
	public class Extra1 extends Sprite {
		private var tf:TextField = new TextField();
		public function Extra1() {
			addChild(tf);
			tf.width = 300;
			var dock:Dock = new Dock();
			dock.x = 150;
			dock.y = 100;
			addChild(dock);
			addEventListener(Event.ENTER_FRAME, IconMove);
		}
		private function IconMove(event:Event):void {
			tf.text = "グローバルx座標" + mouseX + "\nグローバルy座標" + mouseY;
		}
	}
}
import flash.display.Sprite;
import flash.events.Event;
import flash.text.TextField;
class Dock extends Sprite {
	private var tf:TextField = new TextField();
	function Dock() {
		addChild(tf);
		tf.width = 300;
		graphics.lineStyle(0, 0x000000);
		graphics.drawRect(0, 0, 300, 80);
		addEventListener(Event.ENTER_FRAME, IconMove);
	}
	private function IconMove(event:Event):void {
		tf.text = "ローカルx座標" + mouseX + "\nローカルy座標" + mouseY;
	}
}