public static removeListener(listener:Object) : Boolean
Selection.addListener() メソッドを使用して以前に登録したオブジェクトを削除します。
listener:Object - フォーカスの通知受信を中止するオブジェクト。
Boolean - listener オブジェクトが正常に削除された場合は true を返します。listener オブジェクトが正常に削除されなかった場合 (listener が Selection オブジェクトのリスナーリストにない場合など) は false を返します。
次の ActionScript は、いくつかのテキストフィールドインスタンスをダイナミックに作成します。テキストフィールドを選択すると、[出力] パネルに情報が表示されます。remove_btn インスタンスをクリックすると、リスナーが削除され、[出力] パネルに情報が表示されなくなります。
this.createTextField("one_txt", 1, 0, 0, 100, 22);
this.createTextField("two_txt", 2, 0, 25, 100, 22);
this.createTextField("three_txt", 3, 0, 50, 100, 22);
this.createTextField("four_txt", 4, 0, 75, 100, 22);
for (var i in this) {
if (this[i] instanceof TextField) {
this[i].border = true;
this[i].type = "input";
}
}
var selectionListener:Object = new Object();
selectionListener.onSetFocus = function(oldFocus, newFocus) {
trace("Focus shifted from "+oldFocus+" to "+newFocus);
};
Selection.addListener(selectionListener);
remove_btn.onRelease = function() {
trace("removeListener invoked");
Selection.removeListener(selectionListener);
};
このページに新しいコメントが追加された場合に、電子メールでの通知を希望する。 | コメントレポート