有一个父Flex应用程序,允许您在其中嵌入自定义工具(SWF文件)。
我已经检查了父级的HTML包装器,它使用了SWFObject,并且允许全屏显示:
<param name="allowFullScreen" value="true" />
<param name="allowFullScreen" value="true" />我正在尝试组合一个工具,简单地将父应用程序从全屏模式转换为全屏模式。

以下是代码的简化版本。我有tried several variations,但仍然没有运气。
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;
}单步执行代码会发现问题:
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?
发布于 2012-03-10 10:23:58
在Flash player中,您只能在响应鼠标单击时使应用程序全屏显示。您的函数toogleScreen不是鼠标事件处理程序。
发布于 2013-01-02 00:33:09
以下是解决方案
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;
}
}https://stackoverflow.com/questions/9643367
复制相似问题