     /**
      * Set the selectedItem based on the data field.
      */
-    public function setSelectedData (data :Object) :void
+    public function set selectedData (data :Object) :void
     {
         for (var ii :int = 0; ii < dataProvider.length; ++ii) {
-            if (Util.equals(data,
-                    (dataField != null) ? dataProvider[ii][dataField] : dataProvider[ii])) {
+            if (Util.equals(data, itemToData(dataProvider[ii]))) {
                 this.selectedIndex = ii;
                 return;
             }

        CommandButton.validateCmd(cmdOrFn);
        _cmdOrFn = cmdOrFn;

        addEventListener(ListEvent.CHANGE, handleChange);
    }

    /**

     * The value that will be passed to the command or function based on dataField and the
     * current selected item.
     */
    public function get selectedData () :Object
    {
        return itemToData(this.selectedItem);
    }

    /**
     * Extract the data from the specified item. This can be expanded in the future
     * if we provide a 'dataFunction'.
     */
    protected function itemToData (item :Object) :Object
    {
        return (dataField == null) ? item : ((item == null) ? null : item[dataField]);
    }

    protected function handleChange (event :ListEvent) :void
    {
        if (this.selectedIndex != -1) {
            CommandEvent.dispatch(this, _cmdOrFn, selectedData);
        }
    }

