Select to view content in your preferred language

How do I auto tab from one text input to the next?

761
2
01-14-2011 07:27 AM
maryandrews
Regular Contributor
Please help, I'm a newbie!
I am using three text boxes as the input to my parcel APN search. I have the three text boxes working with the max characters set to 3. What I would like to do is when the use enters the 3 characters in the bookText text input box automatically move to the blockText input box so that the user does not have to click on the screen to get to the next box.

Here is the code I have dreamed up. I may be completely on the wrong track?

private function autoTabText_onChange(event:ChangeWatcher):void
   {
    if(bookText.length==3)
    {
     focusManager.setFocus(blockText);
    }
   }



Thanks for your help!
Tags (2)
0 Kudos
2 Replies
maryandrews
Regular Contributor
Well I got the error message to go away!

Just needed to change this line.  Problem is the code doesn't do anything.  Hum?

if(bookText.text.length==3)
0 Kudos
maryandrews
Regular Contributor
Well even though I fell like I'm talking to myself here on this thread I will go ahead and post this since it may help some other newbie!

Here is the code that works!

protected function bookText_changeHandler(event:TextOperationEvent):void
   {
     if(bookText.text.length==3)
     {
      focusManager.setFocus(blockText);
     }
   }

...
<s:TextInput width="56" height="31" x="10" y="68" id="bookText" maxChars="3" change="bookText_changeHandler(event)" />
0 Kudos