I suggest using the selectedItem property instead of selectedIndex.
I witnessed cases where changing the selectedIndex had no impact on the UI
and using selectedItem did work properly.

Good luck,
Evyatar

On Tue, Mar 12, 2013 at 11:29 PM, Alex Harui <[email protected]> wrote:

> Try calling validateNow after changing selectedIndex.
>
>
> On 3/12/13 2:19 PM, "Lucas Junqueira / Ciclope" <[email protected]>
> wrote:
>
> > Hi, I was trying to create an order list withe the spark list control. I
> > would like to move itens up and down, but this seems to be a problem.
> Here
> > is the code I'm trying to use to move an item up. Can anyone tell me why
> it
> > isn't working? The item label is, indeed, changed, but the list selection
> > not (the selected index does not change):
> >
> > if (this.sequenceList.selectedIndex > 0) {
> >     var list1:Object = new Object();
> >     var list2:Object = new Object();
> >     list1.label =
> > String(this.sequenceListData.getItemAt(this.sequenceList.selectedIndex -
> > 1).label);
> >     list1.data =
> > String(this.sequenceListData.getItemAt(this.sequenceList.selectedIndex -
> > 1).data);
> >     list2.label =
> >
>
> String(this.sequenceListData.getItemAt(this.sequenceList.selectedIndex).label)>
> ;
> >     list2.data =
> >
> String(this.sequenceListData.getItemAt(this.sequenceList.selectedIndex).data);
> >     this.sequenceListData.getItemAt(this.sequenceList.selectedIndex -
> > 1).label = list2.label;
> >     this.sequenceListData.getItemAt(this.sequenceList.selectedIndex -
> > 1).data = list2.data;
> >
> this.sequenceListData.getItemAt(this.sequenceList.selectedIndex).label
> > = list1.label;
> >
> this.sequenceListData.getItemAt(this.sequenceList.selectedIndex).data =
> > list1.data;
> >
> >     // the following does not work
> >     this.sequenceList.selectedIndex = this.sequenceList.selectedIndex -
> 1;
> >
> >     // tryied with and without the refresh
> >     this.sequenceListData.refresh();
> > }
> >
> > Thank you all!
>
> --
> Alex Harui
> Flex SDK Team
> Adobe Systems, Inc.
> http://blogs.adobe.com/aharui
>
>

Reply via email to