2010-09-10 80 views
0

我正在嘗試爲簡單的產品滾動器編寫一些代碼。 我有一個產品項目數組,當用戶單擊下一個按鈕時,我想刪除數組最後一個索引處的項目,將其添加到開始索引,然後用結果更新階段。更新數組然後更新階段

回答

1
 
//create a new Array 
var item:Array = []; 

//add the last element of your Array 
item[0] = myArray.pop(); 

//merge both arrays with the last element as the first element 
myArray = item.concat(myArray); 

//update the stage with the new value of myArray