0 Replies Latest reply on Oct 15, 2007 8:39 AM by shadyshotton75

    Setfocus & Listboxes

    shadyshotton75
      Hi All,

      Just so you all know this is my first post, and my first venture into the world of actionscript. I have worked extensively with VB6, but very little with scripting languages, so if I ask a stupid question, go easy!

      OK, I have a project that has 3 layers, one for code, one for the navigation buttons and one for the content of the movie.

      The content of the movie consists of 2 listboxes and 2 movie clips. The listboxes have the name of files listed in them, when the user clicks a file it loads the relevant .swf into the appropriate movie clip, that all works fine.

      The problem I have is that when the movie loads listbox1 has the focus, and I can happily select any of the files in that listbox with one click, but when I try to select a file from the second list box I have to click twice to get it to load. The first click swaps the focus from list box 1 and the second click selects the file.

      The same is true of the navigation buttons at the top, if I have previously been selecting files from the list boxes, in order to navigate to another frame of the movie I have to click once on the button to swap the focus and then once to select the button I want.

      I found some examples using the setfocus function, and tried to adapt it for my list box:-

      list.onRollOver = function() {
      Selection.setFocus("list");
      trace(_global.focuscounter);
      }

      So if I leave out the Selection.setFocus("list");, then Flash dumps a 0 every time my mouse rolls over the box (as expected). As soon as the other line is added I receive a message that a script in my movie may be making it run slowly, and "Do you want to stop the script". When I choose yes it shows the trace window with 20 or 30 zero's in it, so I seem to be generating an infinite loop.

      So basically, how do I enable the user to select either a file from the listbox or a navigation button without them having to click once to swap the selection, and then once to pick the file/button.

      Cheers