1 Reply Latest reply on Jan 18, 2011 1:34 AM by Ibarim

    Esc turns full screen off when .swc game is on stage

    Ibarim Level 1



      I got a game as an movieClip in Flash called 'swcGame'. This game is transformed into a flex component with use of Flex Component Kit. Then the .swc is created and added to Flex library.


      In Flex I got an Air application which works full screen. I use code:

      stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
      stage.scaleMode = StageScaleMode.NO_SCALE;
      stage.align = StageAlign.TOP_LEFT;


      Then I add a component (canvas), which reads options and do other stuff:


      newGame = new Game;


      Inside the 'newGame' component I add the .swc object with the game:


      gameName = new swcGame;
      gameName.percentWidth = 100;
      gameName.percentHeight = 100;


      The problem is that during the game (when .swc object is on stage) whenever I press ESC button on keyboard the flex application is displayed in small window instead of full screen.

      In my flex application I got a code to cancel escaping full screen:


      stage.addEventListener(KeyboardEvent.KEY_DOWN, prevDef);

      public function prevDef(e:KeyboardEvent):void {
            if (e.keyCode == Keyboard.ESCAPE) e.preventDefault();


      and it works fine for other games created in flex. But doesn't work with the .swc. I tried to add this kind of listener to both 'newGame' and 'gameName' objects but with no effect. Code inside 'newGame' object:


      addEventListener(KeyboardEvent.KEY_DOWN, prevDef);
      gameName.stage.addEventListener(KeyboardEvent.KEY_DOWN, prevDef);
      private function prevDef(e:KeyboardEvent):void {
            if (e.keyCode == Keyboard.ESCAPE) e.preventDefault();


      And that's not the only problem. As I wrote above there is a REMOVED_FROM_STAGE listener for the 'newGame' object. After hitting ESC button during .swc game the 'newGame' object is dettected as being removed from the stage.


      I know it's much complicated, but I'd grateful for any suggestions because I can't find anything on the web concerning this topic.