1 Reply Latest reply on Jun 13, 2006 2:27 AM by RajeshBhadra

    Removing focus

      I have some form fields. I would like to remove focus from a field when:
      - the enter key is pressed
      - the mouse is clicks outside a field

        • 1. Re: Removing focus
          are you looking for this... i not done the mouse click part but the remove focus have been done in this example...if the answer is not satisfying you can be send message again.

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initApp()">
          <mx:Panel title="Details" width="100%" height="100%">

          import mx.managers.FocusManager;

          public function initApp():void
          defaultButton = MyButton;


          public function action():void
          append.text =fname.text + " " + dob.text +" " + email.text +" " +
          age.text +" " + ssn.text +" " + zip.text +" " + phone.text;



          <mx:Form width="100%" height="100%">
          <mx:FormItem label="First name">
          <mx:TextInput id="fname" width="200"/>

          <mx:FormItem label="Date of birth (dd/mm/yyyy)">
          <mx:TextInput id="dob" width="200"/>

          <mx:FormItem label="E-mail address">
          <mx:TextInput id="email" width="200"/>

          <mx:FormItem label="Age">
          <mx:TextInput id="age" width="200"/>

          <mx:FormItem label="SSN">
          <mx:TextInput id="ssn" width="200"/>

          <mx:FormItem label="Zip">
          <mx:TextInput id="zip" width="200"/>

          <mx:FormItem label="Phone">
          <mx:TextInput id="phone" width="200"/>

          <mx:FormItem label="Phone">
          <mx:TextInput id="append" width="400" height="200" editable="false"/>
          <mx:Button id="MyButton" label="Button" click="action()"/>