flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lucas Junqueira / Ciclope" <lu...@ciclope.art.br>
Subject help with moving list elements up and down
Date Tue, 12 Mar 2013 21:19:27 GMT
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!

-- 
Lucas Junqueira
lucas@ciclope.art.br / (31)2555-0635 / (31)9133-6635
Ateliê Ciclope de arte e publicação digital

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message