diff --git a/flixel/addons/ui/FlxUIPopup.hx b/flixel/addons/ui/FlxUIPopup.hx index 0b6f1d2..7a495a4 100644 --- a/flixel/addons/ui/FlxUIPopup.hx +++ b/flixel/addons/ui/FlxUIPopup.hx @@ -188,29 +188,20 @@ class FlxUIPopup extends FlxUISubState implements IFlxUIWidget switch (id) { case FlxUITypedButton.CLICK_EVENT: - var str = ""; if (eventParams != null) { - if ((eventParams[0] is String)) + var buttonAmount:Int = Std.int(eventParams[0]); + if ((_parentState is IFlxUIState)) { - str = Std.string(eventParams[0]); + // This fixes a bug where the event was being sent to this popup rather than the state that created it + castParent().getEvent(CLICK_EVENT, this, buttonAmount, eventParams); } - - var buttonAmount:Int = Std.int(eventParams[0]); - if (str == "affirm" || str == "cancel" || str == "alt") + else { - if ((_parentState is IFlxUIState)) - { - // This fixes a bug where the event was being sent to this popup rather than the state that created it - castParent().getEvent(CLICK_EVENT, this, buttonAmount, eventParams); - } - else - { - // This is a generic fallback in case something goes wrong - FlxUI.event(CLICK_EVENT, this, buttonAmount, eventParams); - } - close(); + // This is a generic fallback in case something goes wrong + FlxUI.event(CLICK_EVENT, this, buttonAmount, eventParams); } + close(); } } super.getEvent(id, sender, data, eventParams);