开发者

most rational way to drag popup menu in flex

In my app I currently have a po开发者_如何学运维pup menu implemented as a BorderContainer with a lot of buttons, textfields, date pickers, etc. PopUpManager handles its appearing and disappearing based on some UI events.

I'd like to be able to drag the container by clicking on any part of it minus all the components on it. In other words, when I click on buttons, text fields, etc. I'd like for them to respond as usual and for the container not be draggable.

I've tried this very simple implementation

_menu.addEventListener(MouseEvent.ROLL_OVER, toggleDragON);
_menu.addEventListener(MouseEvent.ROLL_OUT, toggleDragOFF);

private function mouseDown(event:MouseEvent):void 
{ 
    _menu.startDrag(); 
} 

private function mouseReleased(event:MouseEvent):void 
{ 
    _menu.stopDrag(); 
}

but this definitely doesn't do the trick, i.e. all components lead to dragging. I've tried to make sure that mouseEnabled and mouseChildren are true for all the components but this doesn't seem to make any difference.

I then came across this thread which makes a lot of sense, but I have a hard time believing that the best way for one to handle this is to handle all click events for each of the components on the popup. Is there an obviously simple way to do this that I'm missing?

thank you!

f


How about checking the target property of the event to check if it equals your menu?

if (event.target == _menu) {
    _menu.startDrag();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜