3 Replies Latest reply on Dec 17, 2010 12:36 AM by Shongrunden

    Error: Full screen mode is not allowed

    VirtualCoder Level 1

      I am trying to implement "full screen" capabilities and I am getting this error ...

      " SecurityError: Error #2152: Full screen mode is not allowed."

       

      Into the index.template.html file I have inserted this line ...

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

       

      My flex 4 mxml file contains ...

      <s:CheckBox change="onFullScreen(event)"/>

       

      The function looks like this ...

      private function onFullScreen(event:Event):void

      {

      try {

      stage.displayState = (fullScreen.selected ? StageDisplayState.FULL_SCREEN : StageDisplayState.NORMAL);

      } catch (any:*) {

      fullScreen.selected = (stage.displayState == StageDisplayState.FULL_SCREEN);

      Alert.show (any, 'onFullScreen Error' );

      // ignore

      }

      }

       

      Thanks for your help,

      VC

        • 1. Re: Error: Full screen mode is not allowed
          Shongrunden Adobe Employee

          If you use the click event instead of the change event does it work?

          • 2. Re: Error: Full screen mode is not allowed
            VirtualCoder Level 1

            As the error suggests, an attempt is made but it is the security that is acting up.

            In fact, placing anywhere the following statement causes the same error.

             

            stage.displayState = StageDisplayState.FULL_SCREEN;

            • 3. Re: Error: Full screen mode is not allowed
              Shongrunden Adobe Employee

              This works for me, does it work for you?

               

              <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                             xmlns:s="library://ns.adobe.com/flex/spark">

               

                  <fx:Script>

                      <![CDATA[

                          import mx.controls.Alert;

                          private function onFullScreen(event:Event):void

                          {

                              try {

                                  stage.displayState = (fullScreen.selected ? StageDisplayState.FULL_SCREEN : StageDisplayState.NORMAL);

                              } catch (any:*) {

                                  fullScreen.selected = (stage.displayState == StageDisplayState.FULL_SCREEN);

                                  Alert.show (any, 'onFullScreen Error' );

                                  // ignore

                              }

                          }

                      ]]>

                  </fx:Script>

               

                  <s:CheckBox id="fullScreen" change="onFullScreen(event)" label="toggle" />

              </s:Application>