Use focus manager to set focus to a control : Focus « Components « Flex






Use focus manager to set focus to a control

Use focus manager to set focus to a control
          

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:Script>
      
    
        private function reset(event:Event):void {
          focusManager.setFocus(d);
        }
    
    
    </mx:Script>
    <mx:VBox height="100%">
      <mx:Grid>
        <mx:GridRow>
          <mx:GridItem>
            <mx:TextInput id="a" tabIndex="1" />
          </mx:GridItem>
          <mx:GridItem>
            <mx:TextInput id="c" tabIndex="3" />
          </mx:GridItem>
        </mx:GridRow>
        <mx:GridRow>
          <mx:GridItem>
            <mx:TextInput id="b" tabIndex="2" />
          </mx:GridItem>
          <mx:GridItem>
            <mx:TextInput id="d" tabIndex="4" />
          </mx:GridItem>
        </mx:GridRow>
      </mx:Grid>
      <mx:Button label="Reset" click="reset(event)"/>
    </mx:VBox>

</mx:Application>

   
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Focus management and keyboard controlFocus management and keyboard control
2.Handle focusIn and focusOut EventsHandle focusIn and focusOut Events