Reputation: 35
I'm trying to write some code for a simple product scroller. I have an array of product items and when the user clicks the next button I want to remove the item at the last index of the array add add it to the start index and then update the stage with the results.
Upvotes: 0
Views: 482
Reputation: 9572
//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
Upvotes: 1