3 Replies Latest reply on Aug 28, 2007 6:48 AM by levancho

    TextInput  can not setFocus where first running  by ie

    happyok Level 1

      i create a mxml application,include a textinput component . i hope set focus to it when first running.
      when open ie browser,input my html file(compiled my mxml file),this textinput can not setfocus?
      please give me a answer,ths
        • 1. Re: TextInput  can not setFocus where first running  by ie
          levancho Level 3
          is that a text input that does not get focuse or whole flash swf file? and it happens when application first loads ? to test if its swf focuse isue or not,
          just click outside of textiput anywhere and if textarea gets focus then problem is in html.
          • 2. Re: TextInput  can not setFocus where first running  by ie
            happyok Level 1
            ths
            my mxml program is so:
            <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute"
            horizontalAlign="center" verticalAlign="middle"
            applicationComplete="initKey()">

            <mx:Script><![CDATA[
            import mx.managers.IFocusManagerComponent;
            import flash.events.KeyboardEvent;

            private function initKey():void{
            userid.setFocus();
            stage.addEventListener(KeyboardEvent.KEY_DOWN,onKeyDown);
            }
            private function onKeyDown(event:KeyboardEvent):void{
            if(event.keyCode==Keyboard.ENTER){
            var fc:IFocusManagerComponent=this.focusManager.getNextFocusManagerComponent(event.shiftKey);
            if(fc!=null){
            fc.setFocus();
            }
            }
            }

            <mx:TextInput width="148" id="userid" horizontalCenter="-1" verticalCenter="-28" />
            <mx:Button label="set" width="43" id="setse" horizontalCenter="106" verticalCenter="-28"/>
            </mx:Application>

            when i first load html web,userid can not focus.
            • 3. Re: TextInput  can not setFocus where first running  by ie
              levancho Level 3
              this issue is related to IE/html and not flex, Focus is not givven to Flash Object from a html. there is nothing you can possibly do in flex to make this work, if somethign it has to be done in a wrapper.html file.