Roll OVER/OUT and Drag, is it a feature or bug?
Hi guys,
Is it feature, when you finish drag operation of child element, Roll OVER/OUT will be re-dispatched to parent element?
Reproduce:
- Use provided code
- Start drag of a small circle until you leave green rectangle (you will see 'out' trace)
- Now stop drag operation by releasing mouse button
- 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();
}
}
}
