flixel-ui icon indicating copy to clipboard operation
flixel-ui copied to clipboard

Closing a popup substate via mouse click has click fall through to parent state

Open IBwWG opened this issue 7 years ago • 1 comments

Although, this may apply more generally to all HaxeFlixel substates...

IBwWG avatar Aug 09 '16 08:08 IBwWG

Also ran into this. In my case, it was due to FlxMouseEventManager remaining active even though the parent state's update method was not being called.

Workaround: in your parent state, do something like this:

  private var mouseEventManager: FlxBasic;

  override public function openSubState(subState: FlxSubState) {
    mouseEventManager = FlxG.plugins.get(FlxMouseEventManager);
    FlxG.plugins.remove(mouseEventManager);
    super.openSubState(subState);
  }

  override public function closeSubState() {
    super.closeSubState();
    FlxG.plugins.add(mouseEventManager);
  }

ttencate avatar Oct 27 '16 18:10 ttencate