2 Replies Latest reply on Jan 8, 2013 4:04 PM by czigany

    Counting elements in simple list or array

    czigany Level 1

      I'm using a multi-selection list control in MX. I can get a simple list of  the selected items but when I try to determine how many items are selected, I get a void return value.

       

      Here's the code I'm using:

        selectedItems = sprite(19).selectedItems

        selectedCount = selectedItems.count

       

      After the first call returns, selectedItems contains an array of two objects. Each object contains two field ( data and label ). The count call always returns void. I've tried selectedItems.count() which indicates that two parameters are required and every other permutation I can think of.

       

      What's the secret to counting the number of items in a list?