Generally Arrays for which the data is changing should not be used for
binding since Flex will NOT be able to determine when Array data has
changed.
Now, for your issue there are two different solutions:
1. Use an ArrayCollection instead of an Array for you "ta" Array variable
2. Have a temporary Array inside your createTimeArray which you use to
push data into, and then at the very end of your "createTimeArray"
function assign the temporary Array to your "ta" Array variable. Flex
will be able to pick up that the "ta" has changed and trigger the
binding, it's just not able to detect when Array data INSIDE "ta" has
changed.
/Max
On 11/3/07, Mark Forsberg <[EMAIL PROTECTED]> wrote:
>
>
> I have a function that creates an array of objects:
> public function createTimeArray():void{
> var millisecondsPerMinute:int = 1000 * 60;
> var currentDate:Date = new Date();
> var year:int = currentDate.getFullYear();
> var month:int = currentDate.getMonth();
> var day:int = currentDate.getDate();
>
> var startTimeDate:Date = new Date(year,month,day,5,0);
> var ta:Array = new Array();
>
> var i:int;
> for(i = 0;i<102;i++){
> var myObj:Object = new Object();
> myObj.label = startTimeDate;
> myObj.data = i+1;
>
> ta.push(myObj);
> startTimeDate.setTime(startTimeDate.getTime() + (10 *
> millisecondsPerMinute));
> //Alert.show(ta[i].label);
> }
> }
>
> I create a bindable variable:
> [Bindable]
> private var ta:Array;
>
> Call it in my init():
> createTimeArray();
>
> And bind it to my combobox:
> <mx:ComboBox x="74" y="70" width="93" id="cb_departureTime"
> dataProvider="{ta}" labelFunction="convertTime" textAlign="right"
> labelField="label">
>
> I get nothing in my combobox. Any ideas?
> Thanks.
>
> Mark F.