关于flex里面mousedown 和click事件冲突问题的解决办法

var isMouseDown:Boolean=false;
var oldX:Number;
var oldY:Number;
mcq.addEventListener(MouseEvent.MOUSE_DOWN,onMouseDowns);
mcq.addEventListener(MouseEvent.CLICK,onClick);
function onClick(evt:MouseEvent):void {
        if (isMouseDown) {
                return;
        }
        mc.visible = true;
}
function onMouseDowns(evt:MouseEvent):void {
        oldX=mcq.x;
        oldY=mcq.y;
        isMouseDown=false;
        mcq.startDrag(false);
        mcq.addEventListener(MouseEvent.MOUSE_UP,onMouseUps);
}
function onMouseUps(evt:MouseEvent):void {
        if (!(oldX==mcq.x&&oldY==mcq.y)) {
                isMouseDown=true;
        }
        mcq.stopDrag();
        mcq.removeEventListener(MouseEvent.MOUSE_UP,onMouseUps);

posted @ 2013-04-07 20:45  javawebsoa  Views(429)  Comments(0Edit  收藏  举报