ボタンの中に を入れようとしていTextInput
ますが、ボタンが の前にすべてのマウス イベントをインターセプトしているようですTextInput
。
基本的に私はそのBaseButton
ようなクラスを持っています:
public class BaseButton extends Sprite
{
[...]
public function addMouseListeners( target : InteractiveObject = null ) : void {
if ( !target ) target = this;
target.addEventListener(MouseEvent.ROLL_OVER, mouseOverHandler, false, 0, true);
target.addEventListener(MouseEvent.ROLL_OUT, mouseOutHandler, false, 0, true);
target.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler, false, 0, true);
target.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler, false, 0, true);
}
[...]
}
TextInput
エクステンドを入れたいクラスBaseButton
public class AddFilterDropDownListItem extends BaseButton {
private var _input:TextInput;
public function AddFilterDropDownListItem() {
super();
}
override protected function setupAssets():void {
_input = new TextInput();
_input.height = 40;
_input.width = 240;
this.addChild(_input);
_input.appendText("Add..");
}
}
を編集できません。TextInput
クリック イベントが によってキャプチャされているようBaseButton
です。BaseButton
の子供である私TextInput
が優先されない理由がわかりません。
TextInput
親に追加することで問題を解決できます:
override protected function setupAssets():void {
_input = new TextInput();
_input.height = 40;
_input.width = 240;
parent.addChild(_input); //<------ dirty solution
_input.appendText("Add..");
}
なぜ失敗するのか説明できますか?そして、どうすればきれいに解決できますか?
PS: プロジェクトのアーキテクチャを変更できません。クラスを拡張するBaseButton
必要があり、変更できませんBaseButton
。