7 Replies Latest reply on Apr 23, 2006 5:01 PM by orion.doty@gmail.com


      Why is this one so hard. There are a couple dozen posts out there but nothing I have tried works. So here it is.

      An input textbox onScreen with an instance name of: myText - that's it. // no text in the box.
      Running the following script in the action layer in frame one I have:


      This needs to run on Flash Player 6 so I am shying away from getCaretIndex(); and a few other scripts I have seen.
      I'll keep digging around, but by the looks of ALL the questions and postings - this problem has been around for awhile.
      Does ANYONE have an actual working input textbox (test/sample) I can look at? (I am using FlashPro8)
        • 1. Re: Selection.setFocus();
          blemmo Level 1

          the code you posted should work fine (I use it myself in a chat application), once the movie has focus. The only problem I see with it is that if you have the movie on a website, it doesn't get the focus automatically, you have to click somewhere inside the movie first to get the focus to it. Is that your problem here? If so, I'm afraid there's nothing you can do; I searched the web for a "auto-focus flash" script (javascript or whatever), but didn't find anything. You can only add a button or something similar, to let the user click your movie before it sets the focus.

          • 2. Re: Selection.setFocus();
            G_Swank Level 1
            For whatever reason the code I gave you does not work as I thought it would in my movie. What I am after is having the cursor "blinking" when the user gets to this page, so they know they can enter input at that specific location. Right now the way it is working on my system, is, the user enters the page and MUST click inside the text box to see the cursor (caret).

            I have also tried the following to no avail:
            var cursorpos = Selection.getCaretIndex();
            this.onEnterFrame = function () {
            //myText.text = Selection.getCaretIndex();
            • 3. Re: Selection.setFocus();
              blemmo Level 1
              Hm, it should blink once the focus is on the movie. I used the exact 2 lines you posted above and the cursor blinks inside the input field, but only if the movie has focus. If the focus is outside the movie, it doesn't. So maybe something else on the site, or the stage, steals the focus?

              • 4. Re: Selection.setFocus();
                I am having the exact same problem... has anyone found a solution?
                • 5. Re: Selection.setFocus();
                  orion.doty@gmail.com Level 1
                  Blemmo is there any way you can share exactly what you did to get the cursor to blink? It sounds like you have something but I have tried everything to no avail. Also include what version of flash you are compling in and whether or not you are publishing to flash player or web browser. Thanks!!

                  • 6. Re: Selection.setFocus();
                    blemmo Level 1

                    it's just the line Selection.setFocus("textfieldname") and the fact that Flash has focus that make the cursor blink. I tried with publish settings for player 6 & 8, both AS 1 and AS 2, they all work fine in player 8 on Windows. I don't know if maybe the Mac player behaves different... In Win it doesn't matter if it's the plugin or the standalone player.
                    Try a little testmovie: in frame 1, place a stop() and a button that has nextFrame() onRelease. In frame 2, place the textfield, and add Selection.setFocus("textfieldname") to the frame's actions. If you test the movie, the cursor should blink when you pressed the button and the movie enters frame 2. It won't work if you leave out frame 1 with the button, so I guess Flash has to receive the focus through a click inside it to highlight the focused selection.

                    • 7. Re: Selection.setFocus();
                      orion.doty@gmail.com Level 1
                      I got the same results... there is something definately funny about this function but this is something I can work with, thanks alot!!