0
首先,我在_txtbtn
處創建txtfield。然後我選擇任何mc並在它們上創建許多監聽器。現在我想要刪除監聽器,當我點擊_can
。所以我創建了_unselect
函數。但它不能按預期工作。取消選擇as3中的選擇項目
function _txtbtn(e:*):void
{
myText = new TextField();
mc3 = new MovieClip();
myText.text = "text...";
myText.type = "input";
mc3.addChild(myText);
addChild(mc3);
mc3.x = _can.x;
mc3.y = p;
p = mc3.y + mc3.height + 10;
this.mc3.addEventListener(MouseEvent.MOUSE_DOWN,_select);
function _select(e:MouseEvent):void
{
tool_stage.combo.addEventListener(Event.CHANGE,_font);
tool_stage.steeper.addEventListener(Event.CHANGE,_size);
tool_stage.italic.addEventListener(MouseEvent.CLICK,_bold);
tool_stage.colPicker2.addEventListener(ColorPickerEvent.CHANGE, changeColor1);
_can.addEventListener(MouseEvent.MOUSE_DOWN,_unselect);
}
function _unselect(e:*){
mc3.removeEventListener(MouseEvent.MOUSE_DOWN,_select);
}