2012-03-10 66 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; 
    } 
}