1 Reply Latest reply on Jun 8, 2011 10:05 AM by sinious

    Making cursor appear in input text field

    sinious Most Valuable Participant

      Hi all,


      When I Selection.setFocus(someTextField); the cursor doesn't start blinking in the text field. I've tried it in the flash IDE as well as in a HTML page, I can't seem to get the cursor to start blinking automatically in an input TextField.


      Any ideas on why?


      I even did an onEnterFrame script to make sure the TextField was loaded and ready before I did the selection. I've also used Selection.setSelection(0,0) , etc. It just never shows up.


      If I click the input TextField the cursor shows up as normal though. I just want it to automatically appear as this is a form and I want it to be clear to the user which textfield is currently selected when I change focus.


      This is for a touchscreen project with an on-screen keyboard so the user has no mouse.


      Even if the user types some letters and sees them appear in the input box properly the cursor STILL doesn't appear. Only when I click the input does the cursor appear.


      Any tips would be appreciated! Hopefully it's just some silly oversight.

        • 1. Re: Making cursor appear in input text field
          sinious Most Valuable Participant

          Nevermind, after relenetless googling I've figured it out and I'm just posting it here so hopefully this shows up in a search a little less deep.


          EVEN in the IDE, similar to a flash page, you have to click on flash to get flash to focus.


          What that means is the Selection.setFocus(txt) will never work UNTIL you've clicked the flash player, even if you're in the IDE just testing your movie.


          I was setting the selection at the app launch and just because I hadn't clicked flash yet, the cursor never appeared. I found a thread pointing this ridiculos nonsense out and ended up making a debugging button that'd set the selection (by clicking it, I thus focus flash in the process). It works fine after you've focused the flash player but not until.


          This stuff is why I hate digging up old as2 projects. My disdain for AS2