Bloo Apple
Home Games and Movies

Games and Movies

Games and Movies Games and Movies
Latest Game
Pokemon Match
Coming Soon...
Droppin Beats 4
Paper Mario Maze
Want Action?
Join me on my next project to be part of something awesome
 
 
 
 
 

Arrays

In this tutorial I will show you how to set up an Array. An Array is basically a list of variables. Such as a shopping list, or a list of numbers. You can make an Array of integers, or any type of variable, even an Array of Arrays. Those are called 2D Arrays, Or you can even have an Array of Movie Clips. I will provide an example. You can test this by pasting this into an actionscript 3.0's documents frame.

var myArray:Array = ([1,2,3,4,"myString"]);
trace(myArray);

1,2,3,4"myString"

The break Down. First you must initilize it like any other variable, then put the list in parenthesis. Then place a semicolon after inilizing it to say you have created a statement of setting up an array. Then in the trace function it calls the Array and opens up a dialog box of all the things in your array.

You can add or delete things to your list in your Array by using a push statement, or delete items in your Array with a splice command. Here is an example, you can test this by pasting it into a frame in an actionscript 3.0's document.

my 2nd Array

var myArray:Array = ([1,2,3,4,"myString"]);
myArray.push("some text");
myArray.splice(2,1);
Site Created July 17, 2009