darkee999
04-29-2008, 08:56 AM
I have a list on the stage populated with a list of items that I insert one by one. I would like to move the items up/down using some buttons.
This is the code that should move an item:
ActionScript Code:
on (release) {
c = this._parent.listaPoze.selectedIndex;
a = this._parent.listaPoze.getItemAt(c-1);
b = this._parent.listaPoze.getItemAt(c);
this._parent.listaPoze.replaceItemAt(c-1,b);
this._parent.listaPoze.replaceItemAt(c--,a);
this._parent.listaPoze.selectedIndex = c;
this._parent.listaPoze.dispatchEvent({type:"change", target:this._parent.listaPoze}); }
It should move the selected object up and reselect the item that is now a row higher. Actually it selects the old and the new position of the object. Could you please help me! Thank you very much!
This is the code that should move an item:
ActionScript Code:
on (release) {
c = this._parent.listaPoze.selectedIndex;
a = this._parent.listaPoze.getItemAt(c-1);
b = this._parent.listaPoze.getItemAt(c);
this._parent.listaPoze.replaceItemAt(c-1,b);
this._parent.listaPoze.replaceItemAt(c--,a);
this._parent.listaPoze.selectedIndex = c;
this._parent.listaPoze.dispatchEvent({type:"change", target:this._parent.listaPoze}); }
It should move the selected object up and reselect the item that is now a row higher. Actually it selects the old and the new position of the object. Could you please help me! Thank you very much!