Framerate changes after regaining focus on Desktop

Using OpenFL 9.0.2 for Desktop builds. I set the project frameRate to 30 fps and all is fine, but when the game focus is lost and then restored, the frameRate jumps up to 60 fps. I tried setting stage.frameRate = 30 but that has no effect at runtime. Something is overriding the frameRate setting on activate. I’ve looked in the lime and openfl code to find where this might be happening but can’t find it. Or if there is a way to force it to 30 on activate, that would be nice.

It turns out that using stage.frameRate = 30 for desktop does work but it needs to be called later than on activate. Calling it once didn’t work, but calling it on update if frameRate != 30 did the trick.

2 Likes