Problem with input focus in combined flex and plain AS


i'm writing game based on flixel engine , flex.

 

flex code here:

 

<?xml version="1.0" encoding="utf-8"?>
<mx:application
     xmlns:mx="http://www.adobe.com/2006/mxml"
     layout = "absolute"
     width = "640"
     height = "480"
     applicationcomplete = "appcomplete()" xmlns:ns1="*">
     <mx:style source="flex_game.css"/>

     <mx:script>
               <![cdata[
                    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);

                         this.addchild(display);
                         this.addchild(push);
                         this.addchild(console_out);
                         this.addchild(console_in);
                    }          

               ]]>
     </mx:script>

     <mx:textarea
          id="console_in"
          x="5"
          width="630"
          height="98"
          editable="false"
          y="355"
          focusout="playstate.activate_player()" focusin="playstate.deactivate_player()"
          />
     <mx:textinput
          id="console_out"
          x="5" y="454"
          width="552"
          color="#000000"
          focusout="playstate.activate_player()" focusin="playstate.deactivate_player()"
          />
     <mx:button
          id="push"
          x="564"
          y="455"
          label="Жмак!"
          focusout="playstate.activate_player()" focusin="playstate.deactivate_player()"
          />
</mx:application>


part of code here:

 

package
{
     import flash.display.displayobject;
     import mx.core.uicomponent;

     public class display_ui_object extends uicomponent
     {
          public function display_ui_object (sprite: displayobject)
          {
               super();

               focusenabled = true;
                        mousefocusenabled = true;

               explicitheight = sprite.height;
               explicitwidth = sprite.width;               

               addchild(sprite);
          }
     }
}


when click on 1 of flex widgets gives focus, when click on game pane again (out of widgets) flex widget doesn't lose focus. how can it?

ifocusmanagercomponent



More discussions in Flex (Read Only)


adobe

Comments

Popular posts from this blog

How to decompile jsxbin to jsx

Gavik Photoslide GK2: Not able to upload photos - Joomla! Forum - community, help and support

Phoca Guestbook logger registret bruger af - Joomla! Forum - community, help and support