> and i not
> sure create 5 public var for selected index is the best way...

It is actually - especially because you can unit test it without the ui
I'm using a model class for all my comboboxes, which contains the
dataProvider and a selectedIndex property.

However, if you don't want to go down that route, you can either use a
binding function,
if the whole dataProvider is replaced you add CollectionChange
handling to your dataProvider
if it is changed. You can use myArrayCollection.itemUpdated(..) to
trigger this event.

Cheers
Ralf.


On Nov 12, 2007 7:44 PM, danielvlopes <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
>
> Hello Ralf, i'm using a binding but the problem is my combo had array
>  collection and labelfield of combo is "nome", for that reason i must
>  loop over my dataprovider of combobox to find the "nome" saved in
>  database and select that "nome" in combo... i had 5 combobox and i not
>  sure create 5 public var for selected index is the best way...
>
>  I use a custom component for each page in my viewstack, and now i call
>  function on show of this custom component and now work.
>
>  Thanks.
>
>  --- In flexcoders@yahoogroups.com, "Ralf Bokelberg"
>
>
>  <[EMAIL PROTECTED]> wrote:
>  >
>  > Hi Daniel
>  >
>  > If you use a binding between a value of you model and the
>  > selectedIndex of your combobox,
>  > the control updates automatically whenever you change the model
>  property.
>  >
>  > //in MyModel
>  > [Bindable] public var selectedIndex : int
>  >
>  > //in MyForm
>  > <mx:ComboBox selectedIndex="{ myModel.selectedIndex }" .../>
>  >
>  > Now whenever you change myModel.selectedIndex, the combobox will
>  > update automatically.
>  > You can find some more examples of binding in the docs.
>  >
>  > Cheers
>  > Ralf.
>  >
>
>
>  

Reply via email to