Changes to stage.displayState: Where's the event? (Flash, AS3)
-
03-07-2019 - |
Question
What event should I be looking for (on the stage:Stage, I suppose) to get changes to the stage.displayState?
Solution
this works
stage.addEventListener(Event.FULLSCREEN, doThisOnChange);
for both full screen and normal changes. In your doThisOnChange
method, you can figure out which you're in by looking at if (stage.displayState == StageDisplayState.NORMAL) {
etc....
OTHER TIPS
As long as your SWF is not embedded in HTML you should be fine. There are some additional hacks that you'd need to get HTML wrappers to work.
From the documentation:
You can use the
Stage
class'sfullScreen
event to detect and respond when full-screen mode is turned on or off. For example, you might want to reposition, add, or remove items from the screen when entering or leaving full-screen mode, as in this example: