3 Replies Latest reply on Mar 10, 2009 8:38 AM by miche_r

    List flash component In Director

    Level 7
      Hi

      I want to use a list flash component in Director

      I can set the content of listitems with following command

      sprite("listspr").member.labels = ["item 1", "item 2", "item3"]

      I've set multyselection property of the list to true, using Property
      inspector

      Now the question - how can I define, what is the current selection in this
      list

      Commands like sprite("listspr").member.selectedItems or
      sprite("listspr").member.selectedIndeces ends with an error.

      What is the correct code to define current selection in the list

      Any help will be appreciated

      game_dev



        • 1. Re: List flash component In Director
          Level 7
          I've discovered, that I can acess the list of selections through
          sprite("listspr").selectedItems

          But when no one element in list is selected, this lines gives an error -
          property not found
          How can I check if some elements is selected in list, so that id soes not
          cause en error in script?


          "forums.adobe.com" <jorg.mann@gmx.de> wrote in message
          news:gfuh50$533$1@forums.macromedia.com...
          > Hi
          >
          > I want to use a list flash component in Director
          >
          > I can set the content of listitems with following command
          >
          > sprite("listspr").member.labels = ["item 1", "item 2", "item3"]
          >
          > I've set multyselection property of the list to true, using Property
          > inspector
          >
          > Now the question - how can I define, what is the current selection in this
          > list
          >
          > Commands like sprite("listspr").member.selectedItems or
          > sprite("listspr").member.selectedIndeces ends with an error.
          >
          > What is the correct code to define current selection in the list
          >
          > Any help will be appreciated
          >
          > game_dev
          >
          >
          >


          • 2. List flash component In Director
            DAVID NAJAR Level 1
            Hi,

            The code (handler) you need to know if no one item selected and get an empy list instead is:

            on getSelectedItemsList(me)
            vAnySelected = sprite("listspr")["selectedItems"]
            if voidP(vAnySelected) then
            return []
            else
            return sprite("listspr").selectedItems
            end if
            end

            I hope this can help you and leave you anothe behavior script below for your use :).
            • 3. List flash component In Director
              miche_r Level 1
              I have a similar problem, and these codes don't seem to work. I'm not using SelectedItems though, I have a code "sprite(5).SelectedItem.data" and user can only select one value from the list. If nothing is selected, I get a property not found #SelectedItem error. Otherwise everything works, I just need to get rid of that message... any ideas?