on my nexus 7, I get: 1104
Newest openfl/lime with -Dv2
That is not true! My nexus has a screen height of 1200!
I assume that is the screensize without the menu buttons. But since the menu buttons are not shown during the game, it remains incorrect.
How can I get the correct screensize?
A little remark: I get this wrong result, when I trace it during startup. Later, the result is different (I get the correct 1200). But I do not know when the change happens, and I need the correct size during initialization.
I think you should add event listener to your Main class.
class Main extends Sprite
public function new()
It may be dangerous to not initialize(his part) and wait for the RESIZE event. Not sure if RESIZE will be fire in all devices at start.
Maybe the best solution could be a combination, wait for the RESIZE, if it dosen’t arrive in x seconds init with the values from stage.
Yeah, that could work, but it would have to be the second RESIZE event. It turns out OpenFL dispatches one every single time, right after the ADDED_TO_STAGE event.
However, it’s generally better to respond to each RESIZE event as it happens. Not all Android devices will hide the bar that quickly. Plus, if the bar comes back, the app should resize so that nothing gets cut off.