You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by WuThom <mo...@hotmail.com> on 2014/12/10 15:59:54 UTC

issue about FocusIn and FocusOut evnet

Hi:
 
I have a puzzling problem.  At  
first, the TextInput component donot fire the focusIn Event,  then it fired the 
focusOut event,  why?? bug??
 
test step:
1. textinput xx get focus
2. then pressed the tab key 

 
textInput x1 do not fired the 
focusIn  event, but it fired the focusOut event.  
textInput xx is still 
the components that are 
currently gets focus , but did not 
show the cursor indicator. why??
 
example code:

<?xml version="1.0" 
encoding="utf-8"?>
<s:WindowedApplication 
xmlns:fx="http://ns.adobe.com/mxml/2009" 
   
xmlns:s="library://ns.adobe.com/flex/spark" 
   
xmlns:mx="library://ns.adobe.com/flex/mx" >

<fx:Script>
<![CDATA[
import 
mx.core.UIComponent;
protected function 
xx_focusOutHandler(event:FocusEvent):void
{
x1.visible = false; 
}

protected function 
x1_focusInHandler(event:FocusEvent):void
{
trace("x1 focus in"); 
}

protected function 
x1_focusOutHandler(event:FocusEvent):void
{
trace("x1 focus out"); 
}

]]>
</fx:Script>


<s:VGroup>
<s:TextInput id="xx" 
focusOut="xx_focusOutHandler(event)"/>
<s:TextInput id="x1" 
focusIn="x1_focusInHandler(event)" 
focusOut="x1_focusOutHandler(event)"/>
<s:TextInput 
text="x2"/>
</s:VGroup>
</s:WindowedApplication> 
 
 
 Thx
Thom 		 	   		  

Re: issue about FocusIn and FocusOut evnet

Posted by "Seth." <po...@gmail.com>.
Use alpha = 0 if you need this working else it will not able to dispatch
event.

- Seth

On Thursday, December 11, 2014, Alex Harui <ah...@adobe.com> wrote:

> Looks like you are changing visibility on x1.  That might affect focus
> logic if you focus out of xx to x1.
>
> On 12/10/14, 6:59 AM, "WuThom" <moushuai00@hotmail.com <javascript:;>>
> wrote:
>
> >
> >Hi:
> >
> >I have a puzzling problem.  At
> >first, the TextInput component donot fire the focusIn Event,  then it
> >fired the
> >focusOut event,  why?? bug??
> >
> >test step:
> >1. textinput xx get focus
> >2. then pressed the tab key
> >
> >
> >textInput x1 do not fired the
> >focusIn  event, but it fired the focusOut event.
> >textInput xx is still
> >the components that are
> >currently gets focus , but did not
> >show the cursor indicator. why??
> >
> >example code:
> >
> ><?xml version="1.0"
> >encoding="utf-8"?>
> ><s:WindowedApplication
> >xmlns:fx="http://ns.adobe.com/mxml/2009"
> >
> >xmlns:s="library://ns.adobe.com/flex/spark"
> >
> >xmlns:mx="library://ns.adobe.com/flex/mx" >
> >
> ><fx:Script>
> ><![CDATA[
> >import
> >mx.core.UIComponent;
> >protected function
> >xx_focusOutHandler(event:FocusEvent):void
> >{
> >x1.visible = false;
> >}
> >
> >protected function
> >x1_focusInHandler(event:FocusEvent):void
> >{
> >trace("x1 focus in");
> >}
> >
> >protected function
> >x1_focusOutHandler(event:FocusEvent):void
> >{
> >trace("x1 focus out");
> >}
> >
> >]]>
> ></fx:Script>
> >
> >
> ><s:VGroup>
> ><s:TextInput id="xx"
> >focusOut="xx_focusOutHandler(event)"/>
> ><s:TextInput id="x1"
> >focusIn="x1_focusInHandler(event)"
> >focusOut="x1_focusOutHandler(event)"/>
> ><s:TextInput
> >text="x2"/>
> ></s:VGroup>
> ></s:WindowedApplication>
> >
> >
> > Thx
> >Thom
>
>

-- 
Sent from Gmail iPhone App

Re: issue about FocusIn and FocusOut evnet

Posted by Alex Harui <ah...@adobe.com>.
Looks like you are changing visibility on x1.  That might affect focus
logic if you focus out of xx to x1.

On 12/10/14, 6:59 AM, "WuThom" <mo...@hotmail.com> wrote:

>
>Hi:
> 
>I have a puzzling problem.  At
>first, the TextInput component donot fire the focusIn Event,  then it
>fired the 
>focusOut event,  why?? bug??
> 
>test step:
>1. textinput xx get focus
>2. then pressed the tab key
>
> 
>textInput x1 do not fired the
>focusIn  event, but it fired the focusOut event.
>textInput xx is still
>the components that are
>currently gets focus , but did not
>show the cursor indicator. why??
> 
>example code:
>
><?xml version="1.0"
>encoding="utf-8"?>
><s:WindowedApplication
>xmlns:fx="http://ns.adobe.com/mxml/2009"
>   
>xmlns:s="library://ns.adobe.com/flex/spark"
>   
>xmlns:mx="library://ns.adobe.com/flex/mx" >
>
><fx:Script>
><![CDATA[
>import 
>mx.core.UIComponent;
>protected function
>xx_focusOutHandler(event:FocusEvent):void
>{
>x1.visible = false;
>}
>
>protected function
>x1_focusInHandler(event:FocusEvent):void
>{
>trace("x1 focus in");
>}
>
>protected function
>x1_focusOutHandler(event:FocusEvent):void
>{
>trace("x1 focus out");
>}
>
>]]>
></fx:Script>
>
>
><s:VGroup>
><s:TextInput id="xx"
>focusOut="xx_focusOutHandler(event)"/>
><s:TextInput id="x1"
>focusIn="x1_focusInHandler(event)"
>focusOut="x1_focusOutHandler(event)"/>
><s:TextInput 
>text="x2"/>
></s:VGroup>
></s:WindowedApplication>
> 
> 
> Thx
>Thom