2 Replies Latest reply on Aug 3, 2010 11:12 AM by nothing2k9

    Problem with input focus in combined flex and plain AS


      I'm writing game based on Flixel engine and Flex.


      Flex code here:


      <?xml version="1.0" encoding="utf-8"?>
           layout = "absolute"
           width = "640"
           height = "480"
           applicationComplete = "appComplete()" xmlns:ns1="*">
           <mx:Style source="flex_game.css"/>

                          import com.adamatomic.Mode.States.PlayState;
                          import flash.events.FocusEvent;

                          protected function appComplete():void
                               var game:Game2 = new Game2()
                               var display:display_ui_object = new display_ui_object(game);



                focusOut="PlayState.activate_player()" focusIn="PlayState.deactivate_player()"
                x="5" y="454"
                focusOut="PlayState.activate_player()" focusIn="PlayState.deactivate_player()"
                focusOut="PlayState.activate_player()" focusIn="PlayState.deactivate_player()"

      Part of AS code here:


           import flash.display.DisplayObject;
           import mx.core.UIComponent;

           public class display_ui_object extends UIComponent
                public function display_ui_object (sprite: DisplayObject)

                     focusEnabled = true;
                              mouseFocusEnabled = true;

                     explicitHeight = sprite.height;
                     explicitWidth = sprite.width;               


      When I click on one of Flex widgets it gives focus, but when I click on game pane again (out of widgets) Flex widget doesn't lose a focus. How can I do it?