1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
public class MouseBehavior 
{
	//滑鼠按下
	public var setOnMouseDown:Function;
	
	//滑鼠移動
	public var setOnMouseMove:Function;
	
	//滑鼠放開
	public var setOnMouseUp:Function;
	
	//這是用來定義外部呼叫時傳入參數和回應資料型態
	public function onMouseDown(x:int, y:int):void {
		if (setOnMouseDown != null)
			setOnMouseDown(x, y);
	}
	public function onMouseMove(x:int, y:int):void {
		if (setOnMouseMove != null)
			setOnMouseMove(x, y);
	}
	public function onMouseUp(x:int, y:int):void {
		if (setOnMouseUp != null)
			setOnMouseUp(x, y);
	}
}