有一个父Flex应用程序允许您在其中嵌入自定义工具(SWF文件)。
我已检查过父级的HTML包装器并使用SWFObject,并允许全屏:
<param name="allowFullScreen" value="true" />
<param name="allowFullScreen" value="true" />
我正在尝试整合一个简单地将父应用程序带到&amp;从全屏模式。
这是代码的简化版本。我有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有关吗?
答案 0 :(得分:6)
在Flash播放器中,您只能使应用程序全屏显示以响应鼠标单击。您的函数toogleScreen
不是鼠标事件处理程序。
答案 1 :(得分:0)
这是解决方案
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;
}
}