/ Published in: ActionScript
Expand |
Embed | Plain Text
var testArray:Array = ["one", "two", "three", "four"]; trace(testArray); trace("Last to first"); // Bring last item to beginning of array testArray.unshift(testArray.pop()); trace(testArray); testArray.unshift(testArray.pop()); trace(testArray); testArray.unshift(testArray.pop()); trace(testArray); trace("First to last"); // Bring first item to the end of array testArray.push(testArray.shift()); trace(testArray); testArray.push(testArray.shift()); trace(testArray); testArray.push(testArray.shift()); trace(testArray); /* * Output * Last to first one,two,three,four four,one,two,three three,four,one,two two,three,four,one First to last three,four,one,two four,one,two,three one,two,three,four */
You need to login to post a comment.
