HaxeFlixel / flixel-ui

GUI library for HaxeFlixel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

IBwWG opened this issue · comments

commented

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

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);
  }