FlxMouseEventManager: Is it possible to block specific objects of FlxState?

40 views
Skip to first unread message

Extreme Alex

unread,
Dec 23, 2015, 6:39:33 AM12/23/15
to HaxeFlixel
Hi!

There is the following situation. The FlxState contains the buttons that extends FlxSprite added to the FlxMouseEventManager (as buttons have a round form, and basically FlxButton doesn't work with pixel perfect renderer and processes handling on all sprite, not just visible part).

FlxMouseEventManager.add(Img, onDown, onUp, onOver, onOut);

When I open FlxSubstate (for example, popup window), objects from the FlxState continue to receive events from the mouse and react on handling, clicking etc, that is not very good.
To avoid this, it is necessary to make additional - and in fact superfluous - actions, for example, to create a background layer at popup window for interception of mouse events, or in buttons to check existence of Substate in the event handlers.
On the other hand, all FlxButtons on such FlxState are blocked automatically as soon as it has Substate.
Is there any possibility to do the same thing with objects from FlxMouseEventManager?

Thanks!

Gama11

unread,
Dec 23, 2015, 6:59:53 AM12/23/15
to HaxeFlixel
As long as you don't need the mouse event manager for objects within the substate, you can disable it entirely during that period:

FlxG.plugins.get(FlxMouseEventManager).active = false;

Extreme Alex

unread,
Dec 23, 2015, 7:29:50 AM12/23/15
to HaxeFlixel
Nice, thanks! But what if the Substate need mouse event manager, while the parent State is temorarily not needed?
Reply all
Reply to author
Forward
0 new messages