No se permite el modo de pantalla completa con StageDisplayState

There is a parent Flex application that allows you to embed custom tools in it (SWF files).

I have inspected the HTML wrapper for the parent and it uses SWFObject, and has full screen permitted:

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

I am trying to put together a tool that simply takes the parent application to & from full screen mode.

enter image description here

Here is a simplified version of the code. I have probado Varios variaciones, pero aun así no tuve suerte.

public function toogleScreen():void
 // this is fired from a function within the child swf
  if (this.stage.displayState == StageDisplayState.FULL_SCREEN)

Stepping through the code identifies the issue:

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 mx.core::UIComponent/dispatchEvent()[E:\dev\hero_private_beta\frameworks\projects\framework\src\mx\core\]
at mx.core::UIComponent/set initialized()[E:\dev\hero_private_beta\frameworks\projects\framework\src\mx\core\]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\hero_private_beta\frameworks\projects\framework\src\mx\managers\]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\hero_private_beta\frameworks\projects\framework\src\mx\managers\]

What am I missing here? I imagine it maybe related to it being a separate swf to the main parent swf?

preguntado el 10 de marzo de 12 a las 02:03

2 Respuestas

In Flash player, you can only make the application full screen in response to a mouse click. Your function, toogleScreen, is not a mouse event handler.

respondido 10 mar '12, 02:03

I was unaware of this. Any idea then on how to avoid a 2nd click? The 1st click GETs the child SWF. - jakc

Indeed this is very true. Imagine what a horrible thing flash would be for the internet if you clicked on the wrong link and BAM you've got a full-screen takover for some dirty porn site. Yikes. - user562566

Understood. I assume then this limitation means that with the confines on how this application works, I will not be able to do a full screen mode with one mouse click (i.e. 1st click fires swf to launch, and no way to then trigger another mouse click without clicking). - jakc

Aquí está la solución

function toogleScreen():void
 if(stage.displayState == StageDisplayState.FULL_SCREEN_INTERACTIVE || stage.displayState==StageDisplayState.FULL_SCREEN)    

Respondido el 01 de enero de 13 a las 16:01

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.