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