stage.displayState的变化:事件在哪里? (Flash,AS3)

时间:2021-09-30 19:17:44

What event should I be looking for (on the stage:Stage, I suppose) to get changes to the stage.displayState?

我应该寻找什么样的事件(在舞台上:阶段,我想)来改变stage.displayState?

2 个解决方案

#1


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....

全屏和正常更改。在你的doThisOnChange方法中,你可以通过查看if(stage.displayState == StageDisplayState.NORMAL){etc ....来确定你所处的位置。

#2


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.

只要你的SWF没有嵌入HTML,你应该没问题。还有一些额外的黑客可以让HTML包装器工作。

From the documentation:

从文档:

You can use the Stage class's fullScreen 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:

您可以使用Stage类的fullScreen事件来检测全屏模式打开或关闭时的响应。例如,您可能希望在进入或退出全屏模式时从屏幕重新定位,添加或删除项目,如下例所示:

#1


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....

全屏和正常更改。在你的doThisOnChange方法中,你可以通过查看if(stage.displayState == StageDisplayState.NORMAL){etc ....来确定你所处的位置。

#2


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.

只要你的SWF没有嵌入HTML,你应该没问题。还有一些额外的黑客可以让HTML包装器工作。

From the documentation:

从文档:

You can use the Stage class's fullScreen 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:

您可以使用Stage类的fullScreen事件来检测全屏模式打开或关闭时的响应。例如,您可能希望在进入或退出全屏模式时从屏幕重新定位,添加或删除项目,如下例所示: