Select text in TextInput control : TextInput Selection « Components « Flex






Select text in TextInput control

Select text in TextInput control
          
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

  <mx:Script>
    
      import mx.controls.Alert;
      private function selectText():void
      {
        myInput.selectionBeginIndex = 0;
        myInput.selectionEndIndex = myInput.text.length;
        myInput.setFocus();
      }
      
  
  </mx:Script>
  <mx:HBox>
    <mx:Label text="Enter some text:"/>
    <mx:TextInput id="myInput"/>
    <mx:Button label="Select all text" click="selectText()"/>
  </mx:HBox>
</mx:Application>

   
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Show the selection in TextInput ControlShow the selection in TextInput Control
2.Display the selections of the TextInput control when you click the buttonDisplay the selections of the TextInput control when you click the button