Actionscript 3 StageDisplayState不允许全屏模式

Actionscript 3 StageDisplayState不允许全屏模式,actionscript-3,apache-flex,fullscreen,Actionscript 3,Apache Flex,Fullscreen,有一个父Flex应用程序,允许您在其中嵌入自定义工具(SWF文件) 我已经检查了父级的HTML包装,它使用SWFObject,并且允许全屏显示: <param name="allowFullScreen" value="true" /> <param name="allowFullScreen" value="true" /> 单步通过代码识别问题: SecurityError: Error #2152: Full screen mode is not allowed.

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

我已经检查了父级的HTML包装,它使用SWFObject,并且允许全屏显示:

<param name="allowFullScreen" value="true" />
<param name="allowFullScreen" value="true" />
单步通过代码识别问题:

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]

我错过了什么?我想这可能与它是一个独立于主父swf的swf有关。

在Flash player中,您只能通过鼠标点击使应用程序全屏显示。您的函数“toogleScreen”不是鼠标事件处理程序。

以下是解决方案

function toogleScreen():void
{    
 if(stage.displayState == StageDisplayState.FULL_SCREEN_INTERACTIVE || stage.displayState==StageDisplayState.FULL_SCREEN)    
   {
      stage.displayState=StageDisplayState.NORMAL;
   }
   else
   {
      stage.displayState=StageDisplayState.FULL_SCREEN;
   }
}

我没有意识到这一点。有没有办法避免第二次点击?第一次点击就得到了子SWF。事实上,这是非常正确的。想象一下,如果你点击了错误的链接,然后砰的一声,你得到了一个肮脏色情网站的全屏接管,flash对互联网来说将是多么可怕的事情。我明白了。我假设这一限制意味着,由于该应用程序的工作方式受到限制,我将无法通过一次鼠标单击来实现全屏模式(即,第一次单击将触发swf启动,并且没有单击就无法触发另一次鼠标单击)。
function toogleScreen():void
{    
 if(stage.displayState == StageDisplayState.FULL_SCREEN_INTERACTIVE || stage.displayState==StageDisplayState.FULL_SCREEN)    
   {
      stage.displayState=StageDisplayState.NORMAL;
   }
   else
   {
      stage.displayState=StageDisplayState.FULL_SCREEN;
   }
}