Oh, this is something I'm very proud of in my game. This is how it works:
https://youtu.be/C2bP6rZcmEY
The screen can be of any dimensions, the game aligns the interface buttons and open screens at the correct positions.
This is how it works
- Main stage listens to flash.events.Event.RESIZE event
- Inside this event I set up new dimensions for the Starling viewport. It takes the ratio between the sides of the stage, but also makes sure that no side of the viewport will be less than the guaranteedMinSide.
Example: stage dimensions are 640x320, guaranteedMinSide=1000. Then the starling viewport will be 2000x1000
- Then I use "Chain of Responsibility" pattern to make the game interface react to the window resize. For example, the statistics panels (which is always shown at the bottom of the screen and takes its full width) calls it handleResize method after a chain: Starling Application -> Game World -> Panels Manager -> Statistic Panel
This approach lets me also handle device rotation without any additional work, it is also resize event.