Overriding onFocusLost() in FlxState doesn't seem to work

194 views
Skip to first unread message

MegaLeon

unread,
Sep 15, 2014, 3:45:24 PM9/15/14
to haxef...@googlegroups.com


Hi all, I have got

override public function onFocusLost():Void
{
        super.onFocusLost();
        
        trace("Lost Focus");
        // other stuff  
}

in my PlayState for overriding the onFocusLost(), but it doesn't seem to work. I alt-tab to another application and the game does lose focus, as the "Flixel core focus lost screen" comes up and the game autopauses itself, but none of the code gets executed. Am I doing anything wrong here?

Gama11

unread,
Sep 15, 2014, 3:46:27 PM9/15/14
to haxef...@googlegroups.com
Try

FlxG.autoPause = false;

MegaLeon

unread,
Sep 15, 2014, 5:36:36 PM9/15/14
to
That seemed to do the trick, thanks Gama!

I did see this option being mentioned when searching online about the issue, although I wasn't assuming that they would exclude each other. What if I still want the game to pause and do some extra stuff? Will I have to implement a pause system of my own?

Gama11

unread,
Sep 15, 2014, 6:10:43 PM9/15/14
to haxef...@googlegroups.com
You're right, it seems a little arbitrary - besides, it's not properly documented. I changed it here  - should be simple enough to patch your flixel version accordingly so you don't have to update to dev.

On Monday, September 15, 2014 11:36:36 PM UTC+2, MegaLeon wrote:
That seemed to do the trick, thanks Gama!

I did see this option being mentioned when searching online about the issue, although I wasn't assuming that they would exclude each other. What if I still want the game to pause and do some extra stuff? Will I have to implement a pause system of my own?

On Monday, 15 September 2014 20:46:27 UTC+1, Gama11 wrote:

MegaLeon

unread,
Sep 16, 2014, 6:51:40 AM9/16/14
to haxef...@googlegroups.com
Many thanks!
Reply all
Reply to author
Forward
0 new messages