A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Getting position within a text field?

  1. #1
    Member
    Join Date
    Oct 2000
    Location
    Los Angeles, Ca
    Posts
    34

    Smile

    This might be an interesting question for all of you Flash Gurus out there. I have created a form in Flash. I have set the tab order so the user can move from field to field using the tab key. I have also split fields such as the phone number into three separate text boxes (area code, first three digits, last four digits). My question: is there a way to check for the position in the text field so that when the user comes to the end of a field they will automatically go to the next field? I would appreciate any ideas you might have (Like most of us I'm now obsessed with figuring this out).

    Thank you,

    Ron

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    if the cursor (the selection) is in a field, you can read out Selection.caretIndex()
    I had no luck to get a keypress event from an input text field, so I placed the text box in a MC and use this in an onClipEvent(enterFrame)

    Musicman

  3. #3
    Member
    Join Date
    Oct 2000
    Location
    Los Angeles, Ca
    Posts
    34

    Smile Thnx

    Musicman,

    Thank you for the info. I have over 80 text fields in this form so I might wait until the next time to fully implement your suggestions (I will try it right now on the phone numbers, etc.). At least I'll be able to sleep at night instead of ActionScript running through my mind all night.

    Thank you again,

    Ron

  4. #4

    Red face Some specific code

    Ron,
    MusicMan is right on track. To get more specific I would include an if statement that reads like this


    if(Selection.getFocus() == _level0.inputTextFieldName && Selection.getCaretIndex()== 3){
    Selection.setFocus("_level0.nextInputField")
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center