7 Replies Latest reply on Nov 14, 2007 8:33 AM by Pop_Clingwrap

    Tab Structure

    Pop_Clingwrap Level 1
      I add several instance of a clip from the library to a container clip on the stage, each instance has an input field within it and a button. I want to be able to move from one input field to the next with the tab key whilst skipping the buttons but can't make it work. I either tab between the button and the field repeatedly within one movie or cant tab anywhere (when tabIndex is set). Any thoughts on the subject please as I am stumped and pretty fed up with looking at it.

      Cheers all
        • 1. Re: Tab Structure
          Level 7
          Hi --

          What version of Flash are you using?

          Your best approach is to use a "KEYDOWN" event on the stage to capture the
          key press before the movie clip does. Inside this event you can evaluate the
          key pressed and if it is a TAB key you can move from one control to another
          using ActionScript.

          If you understand how to accomplish the above let me know and I will give
          you more detail on moving through controls programatically. If not, I will
          try to provide you with more specific details once I know which version of
          Flash and AS you are using.

          Rich

          "Pop Clingwrap" <webforumsuser@macromedia.com> wrote in message
          news:fhcgom$2dr$1@forums.macromedia.com...
          >I add several instance of a clip from the library to a container clip on
          >the
          > stage, each instance has an input field within it and a button. I want to
          > be
          > able to move from one input field to the next with the tab key whilst
          > skipping
          > the buttons but can't make it work. I either tab between the button and
          > the
          > field repeatedly within one movie or cant tab anywhere (when tabIndex is
          > set).
          > Any thoughts on the subject please as I am stumped and pretty fed up with
          > looking at it.
          >
          > Cheers all
          >


          • 2. Re: Tab Structure
            Pop_Clingwrap Level 1
            I publishing foe FL7 AS2.
            The annoying thing is that within the context of this project (very dynamic, 60+ custom classes) I cant make this work but if I set up a simple test file it seems fine and I can tab through textfields regardless of where they are in the hierarchy of movies. I can only assume that there is something else going on here that I have missed.

            I had actually started putting together a key capturing method like you suggested but have not finished it yet. I will finish it and then probably be back.

            Cheers
            • 3. Re: Tab Structure
              Pop_Clingwrap Level 1
              OK, I am half way there I think.
              I have got it capturing Tab key presses and the focus is shifting in the correct order. I can access properties of the fields such as .text and _x but I cant get it to take keyboard input without clicking it first.

              I am using Selection.setFocus(focusTarget) to change focus and this seems to be all good but then using Selection.setSelection(0, 5) to ready the field to take input seems to have no effect.

              Am I going about this the wrong way?
              • 4. Re: Tab Structure
                Pop_Clingwrap Level 1
                To add another layer of confusion, in the test movie environment it works as i said above but when i run it in a browser it causes certain methods associated with buttons (not in my tabList array) to be called.
                I think I am gonna give up on this one :(
                • 5. Re: Tab Structure
                  Pop_Clingwrap Level 1
                  Ignore my last post. The problem was that I was being a complete numpty. This is a common cause of bugs in my actionscript :)
                  • 6. Re: Tab Structure
                    Level 7
                    Hi --

                    Usually I call the setFocus() function from the item itself..

                    textfield.setFocus()

                    Not sure if that will help your issue with being able to type into the text
                    field.

                    As far as the browser caputring the tabs -- I believe this happens if the
                    last control in the tab order of the movie is selected or if the whole movie
                    is selected. I'm not 100% sure of how to stop this from happening.

                    I am wondering if something in the custom classes you have set up is causing
                    the problem since you are seeing different behavior in a test movie.

                    I will create a movie with clips with buttons and text fields and play
                    around with it a little and get back to yuo.

                    Rich


                    "Pop Clingwrap" <webforumsuser@macromedia.com> wrote in message
                    news:fhehgq$pfc$1@forums.macromedia.com...
                    > OK, I am half way there I think.
                    > I have got it capturing Tab key presses and the focus is shifting in the
                    > correct order. I can access properties of the fields such as .text and _x
                    > but I
                    > cant get it to take keyboard input without clicking it first.
                    >
                    > I am using Selection.setFocus(focusTarget) to change focus and this seems
                    > to
                    > be all good but then using Selection.setSelection(0, 5) to ready the field
                    > to
                    > take input seems to have no effect.
                    >
                    > Am I going about this the wrong way?
                    >
                    >


                    • 7. Re: Tab Structure
                      Pop_Clingwrap Level 1
                      Cheers Rich,
                      I tried calling the function from the item (which I didn't know you could do) but it makes no difference. Focus still changes but setSelection has no effect and the fields will not take input unless clicked.

                      If you do come up with anything else I would be very grateful