Manipulating Array Contents
Flash CS4 ActionScript 3.0 Tutorial
How to Manipulate Data within an Array Variable Using Flash ActionScript
Once you have loaded your Array variable with data, you may wish to move, change or replace the contents. There are multiple ways to alter array values.
In this example we will demonstrate using pop and shift to remove items from the Array. The push and unshift methods add Array contents and reverse changes the Array order.
Open a new Flash document and name the default layer Actions.
Option double-click (PC - Alt double-click) frame one of the Actions layer.
Copy/Paste the following code to the ActionScript panel.
var colors:Array = new Array("Red", "Green", "Blue");
trace("Start: " + colors + colors + colors);
trace("Reverse: " + colors + colors + colors);
trace("Unshift: " + colors + colors + colors + colors);
trace("Push: " + colors + colors + colors + colors + colors);
trace("Pop: " + colors + colors + colors + colors + colors);
trace("Shift: " + colors + colors + colors + colors + colors);
Publish your movie by pressing Cmd/Return (PC - Ctrl/Enter). The Array values are displayed in the Output panel.
Dissecting the Code
The first line of the code at Step Three establishes a new variable named colors. For the colors variable, Red is loaded in slot , Green is in slot  and Blue is loaded in slot .
Line two traces the initial values for slots ,  and .
The next line of the code reverses the order of the Array contents. A trace statement shows you the results.
The same is true for the following blocks of code. Unshift adds an item at the beginning and push adds one at the end. Pop removes the last item and shift removes the contents of the first slot . Once you remove the contents of slot , the contents from the upper slots move down a notch.
The extra Array locations were included in the final two blocks to show that once the contents was removed, the value for that slot became undefined.