_xmouse (MovieClip._xmouse プロパティ)

public _xmouse : Number (読み取り専用)

マウス位置の x 座標を返します。

対応バージョン : ActionScript 1.0、Flash Player 5

次の例では、ステージ (_level0) 上のマウスの現在の x 座標と y 座標と、そのステージ上のムービークリップ my_mc を基準とする相対位置を返します。

this.createTextField("mouse_txt", this.getNextHighestDepth(), 0, 0, 150, 66);
mouse_txt.html = true;
mouse_txt.multiline = true;
var row1_str:String = "&nbsp;\t<b>_xmouse\t</b><b>_ymouse</b>";
my_mc.onMouseMove = function() {
    mouse_txt.htmlText = "<textformat tabStops='[50,100]'>";
    mouse_txt.htmlText += row1_str;
    mouse_txt.htmlText += "<b>_level0</b>\t"+_xmouse+"\t"+_ymouse;
    mouse_txt.htmlText += "<b>my_mc</b>\t"+this._xmouse+"\t"+this._ymouse;
    mouse_txt.htmlText += "</textformat>";
};

この例で使用している MovieClip.getNextHighestDepth() メソッドには Flash Player 7 以降が必要です。SWF ファイルにバージョン 2 のコンポーネントがある場合は、MovieClip.getNextHighestDepth() メソッドではなく、バージョン 2 のコンポーネントの DepthManager クラスを使用します。

関連項目

Mouse, _ymouse (MovieClip._ymouse プロパティ)


 

このページに新しいコメントが追加された場合に、電子メールでの通知を希望する。 | コメントレポート

現在のページ: http://livedocs.adobe.com/flash/9.0_jp/main/00001988.html