項目を 1 つの位置で上下にバブルできるようにしたい ArrayCollection があります。これを行う最善の方法は何ですか?
2 に答える
6
var ac:ArrayCollection = new ArrayCollection(yourArraySource);
ac.removeItemAt(n); // where n > 0 and n < ac.length
ac.addItemAt( item, n-1); // where n>0 ... you should test for that
等
于 2010-03-23T00:25:11.110 に答える
1
Robusto の 2 つの関数呼び出しを 1 行にまとめる :)
ac.addItemAt(ac.removeItemAt(n), n-1);
ArrayListのremove...
関数は削除される項目を返すため、コレクション内で簡単に位置を変更できます。
于 2010-03-23T01:30:12.550 に答える