Steve,

Do me a favor and test something out. Make the items Array an
ArrayCollection on your own.

Here is the gist: When you pass an Array to either ComboBox or List it
makes an ArrayCollection out of it for the purposes of binding. List
does something slightly different in that it stops listening to the
existing collection first. This may mean nothing at all.

However, I am concerned that you are getting lucky on the timing of
the ComboBox. This is just a guess, but try it and post back some code
if it does not work, I will be glad to look at it.

Mike

--- In flexcoders@yahoogroups.com, "stevex" <[EMAIL PROTECTED]> wrote:
>
> I have a binding problem that seems simple, but I can't figure it out.
>  Here's the deal:
> 
> I have a class that I'm using as my model.  It looks like this:
> 
>   [Bindable]
>   public class MyModel
>   {
>     public var items:Array = new Array();
>   }
> 
> I have a class whose objects populate the array:
> 
>   [Bindable]
>   public class MyItem
>   {
>     public var name:String;
>   }
> 
> I declare an appModel variable in the MXML (with the appropriate    
> xmlns:local="*" to make it work):
> 
>   <local:ChoreAppModel id="appModel"/>
> 
> When the app starts up I put a few test items in the array:
> 
>   var anItem:MyItem = new MyItem();
>   anItem.name = "Test 1";
>   appModel.items.push(anItem);
> 
>   anItem:MyItem = new MyItem();
>   anItem.name = "Test 2";
>   appModel.items.push(anItem);
> 
> Now, if I create a ComboBox and bind it thusly:
> 
>   <mx:ComboBox labelField="name"
>    dataProvider="{appModel.items}"/>
> 
> It works:  I see Test 1 and Test 2 in my ComboBox.  But if I bind it
> to a List:
> 
>   <mx:List dataProvider="{appModel.items}" labelField="name"/>
> 
> I see nothing.  Funny thing is, if I create a global array and bind
> the list to that, it works.  So it seems to have something to do with
> the fact that the array is a property of appModel.
> 
> What am I missing?
> 
> Thanks.
> --
> Steve Tibbett
> [EMAIL PROTECTED]
>





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to