Full screen mode not allowed with StageDisplayState

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

I have checked the HTML wrapper for the parent and is using SWFObject and full screen allowed:

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

      

I'm trying to put together a tool that just brings the parent application to and from full screen mode.

enter image description here

Here's a simplified version of the code. I tried several but still no luck.

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

      

Running the code identifies the problem:

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]

      

What am I missing here? I suppose it might have something to do with the fact that it is a separate swf for the main parent swf?

+3


source to share


2 answers


In Flash Player, you can make the application full screen in response to a mouse click. Your function is toogleScreen

not a mouse event handler.



+6


source


Here is the solution



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

      

0


source







All Articles