Skip to main content
Nicolas Siver
Participating Frequently
November 11, 2015
Question

Roll OVER/OUT and Drag, is it a feature or bug?

  • November 11, 2015
  • 2 replies
  • 1411 views

Hi guys,

Is it feature, when you finish drag operation of child element, Roll OVER/OUT will be re-dispatched to parent element?

Reproduce:

  1. Use provided code
  2. Start drag of a small circle until you leave green rectangle (you will see 'out' trace)
  3. Now stop drag operation by releasing mouse button
  4. You can see ('over' event is re-dispatched and every mouse move triggers 'out' once)

Environment:

Flash Player: 17.0.0.134, same reproducible in Chrome: 19.0.0.226

OS X El Capitan, Version 10.11.1

Example Code:

package {

    import flash.display.Sprite;

    import flash.events.MouseEvent;

    import flash.geom.Rectangle;

    public class Main extends Sprite {

        private var _drag:Sprite;

        public function Main() {

            var sensor:Sprite = new Sprite();

            _drag = new Sprite();

            sensor.addEventListener(MouseEvent.ROLL_OUT, mouseOut);

            sensor.addEventListener(MouseEvent.ROLL_OVER, mouseOver);

            sensor.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);

            addChild(sensor);

            sensor.addChild(_drag);

            sensor.x = sensor.y = 100;

            sensor.graphics.beginFill(0x009900);

            sensor.graphics.drawRect(0, 0, 100, 100);

            _drag.graphics.beginFill(0x990099);

            _drag.graphics.drawCircle(0, 0, 5);

            _drag.x = _drag.y = 10;

        }

        private function mouseDown(e:MouseEvent):void {

            _drag.startDrag(true, new Rectangle(10, 10, 50, 0));

            stage.addEventListener(MouseEvent.MOUSE_UP, mouseUp);

        }

        private function mouseOver(e:MouseEvent):void {

            trace('over');

        }

        private function mouseOut(e:MouseEvent):void {

            trace('out');

        }

        private function mouseUp(e:MouseEvent):void {

            _drag.stopDrag();

        }

    }

}

This topic has been closed for replies.

2 replies

jeromiec83223024
Inspiring
November 17, 2015

You added the over and out listeners to the rectangle, so you *should* get events when the mouse enters or leaves the rectangle regardless of whether you did the drag or not (which is what I'm seeing on both my El Capitan and Windows boxes).

The scenario where you drag out and release does appear to dispatch an extraneous event on MacOS 10.11.1.  It does *not* do this on Win7.  I don't have an older MacOS handy to try.  My guess is that we need to make an adjustment for a change in the OS. This is also happening in the standalone debugger in Flash Pro (on mac only), so it's not browser-specific.

I'll follow up with a bug number in a few.

jeromiec83223024
Inspiring
November 17, 2015

I filed bug 4088503 on your behalf, over at bugbase.adobe.com.