I thought I had this figured out...  But apparently I don't...

Can someone please tell me why this won't work as a custom ItemRenderer?  I 
scroll up and down, and the selected value in the ComboBox does NOT change, but 
the values in the drop-down DO change.  I'm at a loss as to why...

BEGIN CODE:
<?xml version="1.0" encoding="utf-8"?>
<mx:ComboBox xmlns:mx="http://www.adobe.com/2006/mxml";  height="100%" 
width="100%"
                         dataProvider="{listOfFees}" 
labelFunction="formatLabel" change="changeHandler(event)" 
                         openDuration="0" closeDuration="0">
        <mx:Script>
                <![CDATA[
                        import mx.formatters.CurrencyFormatter;
                        import mx.controls.DataGrid;
                        import flash.events.Event;
                        
                        [Bindable]private var listOfFees:Array;
                        
                        public override function set data(value:Object):void{
                super.data = value;
                if (value == null) {
                        listOfFees = null;
                } else {
                        if (data.comp != "y") {
                                listOfFees = data.course_fees.concat();
                        } else {
                                listOfFees = new Array([0]);
                        }
                        
                        if (data.editable == "y") {
                                this.enabled = true;
                        } else {
                                this.enabled = false;
                        }
                        
                        this.selectedItem = data.fee_chosen;
                }
                        }
                        
                        private function formatLabel(item:Object):String {
                                return currencyFormat.format(item);
                        }
                        
                        public function changeHandler(event:Event):void {
                                data.fee_chosen = this.selectedItem;
                        }
                        
                ]]>
        </mx:Script>
        
        <mx:CurrencyFormatter id="currencyFormat" precision="2"/>

</mx:ComboBox>

Reply via email to