StageDisplayState不允许全屏模式

Sim*_*mon 3 apache-flex fullscreen actionscript-3

有一个父Flex应用程序,允许您在其中嵌入自定义工具(SWF文件).

我检查了父包装的HTML包装器,它使用SWFObject,并允许全屏:

<param name="allowFullScreen" value="true" />
<param name="allowFullScreen" value="true" />
Run Code Online (Sandbox Code Playgroud)

我正在尝试将一个简单地将父应用程序带到全屏模式的工具.

在此输入图像描述

这是代码的简化版本.我尝试 了几种 变化,但仍然没有运气.

public function toogleScreen():void
{
 // this is fired from a function within the child swf
  if (this.stage.displayState == StageDisplayState.FULL_SCREEN)
   this.stage.displayState=StageDisplayState.NORMAL;
 else
   this.stage.displayState=StageDisplayState.FULL_SCREEN;
}
Run Code Online (Sandbox Code Playgroud)

单步执行代码可识别问题:

SecurityError: Error #2152: Full screen mode is not allowed.
at flash.display::Stage/set_displayState()
at flash.display::Stage/set displayState()
at ExampleCustomTools.FullScreen::fullscreen/toogleScreen()[C:\Users\Simon\Adobe Flash Builder 4\DekhoSimulator_Viewshed\src\ExampleCustomTools\FullScreen\fullscreen.mxml:53]
at ExampleCustomTools.FullScreen::fullscreen/init()[C:\Users\Simon\Adobe Flash Builder 4\DekhoSimulator_Viewshed\src\ExampleCustomTools\FullScreen\fullscreen.mxml:40]
at ExampleCustomTools.FullScreen::fullscreen/___fullscreen_Module1_creationComplete()[C:\Users\Simon\Adobe Flash Builder 4\DekhoSimulator_Viewshed\src\ExampleCustomTools\FullScreen\fullscreen.mxml:7]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[E:\dev\hero_private_beta\frameworks\projects\framework\src\mx\core\UIComponent.as:12977]
at mx.core::UIComponent/set initialized()[E:\dev\hero_private_beta\frameworks\projects\framework\src\mx\core\UIComponent.as:1757]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\hero_private_beta\frameworks\projects\framework\src\mx\managers\LayoutManager.as:819]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\hero_private_beta\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1157]
Run Code Online (Sandbox Code Playgroud)

我在这里错过了什么?我想这可能与它是一个单独的主SWF的SWF有关?

Tyl*_*eto 6

在Flash播放器中,您只能使应用程序全屏显示以响应鼠标单击.您的函数toogleScreen不是鼠标事件处理程序.