2012-03-10 63 views
3

有一个父级Flex应用程序,允许您在其中嵌入自定义工具(SWF文件)。StageDisplayState不允许全屏模式

我已检查了HTML包装家长和它使用的SWFObject,并有允许全屏:

<param name="allowFullScreen" value="true" /> 
<param name="allowFullScreen" value="true" /> 

我试图把一个工具,简单地从全屏幕占据父应用&模式。

enter image description here

下面是代码的简化版本。我有triedseveralvariations,但仍然没有运气。步进通过代码

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?

回答

6

在Flash播放器中,您只能使应用程序全屏响应鼠标单击。您的功能toogleScreen不是鼠标事件处理程序。

+0

我不知道这一点。任何想法,然后在如何避免第二次点击?第1次点击获取子SWF。 – Simon 2012-03-10 03:34:46

+1

事实上,这是非常真实的。想象一下,如果你点击了错误的链接和BAM,你有一个全屏幕的洗手间去看一些肮脏的色情网站,那么闪光灯对于互联网来说是一件可怕的事情。让人惊讶。 – 2012-03-10 05:35:12

+0

了解。我认为这个限制意味着,随着关于这个应用程序如何工作的限制,我将无法通过单击一次鼠标来完成全屏模式(即,第1次点击触发swf启动,并且无法再触发另一次鼠标点击而没有点击)。 – Simon 2012-03-11 01:25:05

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; 
    } 
}