00:00
00:00
View Profile dank
Former Flash author/mage.

Male

Game Developer

Philly

Joined on 10/11/05

Level:
22
Exp Points:
5,022 / 5,380
Exp Rank:
11,671
Vote Power:
6.36 votes
Rank:
Police Lieutenant
Global Rank:
5,095
Blams:
575
Saves:
1,253
B/P Bonus:
14%
Whistle:
Normal
Trophies:
2
Medals:
310
Gear:
5

Altering these settings may filter what you see.

Latest News

More

Arrays make a great way to store and manage data in actionscript. However, sometimes just a single dimension may not be adequate for some situations such as when storing table data. Then you will need to either: define an array for each column for every row, or just make a one two-dimensional array.

A two-dimensional array can be thought of an array nested in an array. To instantiate an array, we can either do:

var arr1:Array = new Array(1, 2, 3);
var arr2:Array = new Array(4, 5, 6);
var arr3:Array = new Array(7, 8, 9);
var arr:Array = new Array(arr1, arr2, arr3);

Or the quicker way:

var arr:Array = new Array([1, 2, 3], [4, 5, 6], [7, 8, 9]);

All we're doing here is defining arrays inside of an array. To reference a two-dimensional array is practically the same as a normal array except for we have a second element to reference. This means we just need to add another "[n-1]:"

// Output: 6
trace(arr[1][2]);

To add a new element to the first array, we can use the same syntax as we would with a single-dimension array, but we would be pushing an array data type:

// Adds another element to the outer array
arr.push(arr1);

To add an element to one of our existing arrays, we reference the array's element in the outer array:

// Ads a sub element to arr1[1] (= 4,5,6)
arr[1].push(arr1);

The rest of the functions in the Array package are used in the same way, but with different references to the caller.


1

Recent Game Medals

4,170 Points
100 Enemies Killed

100 Enemies Killed 10 Points

100 Enemies Killed

Upgrade Bought

Upgrade Bought 5 Points

Upgrade Bought

10 Enemies Killed

10 Enemies Killed 5 Points

10 Enemies Killed

Secret medal!

Secret Medal ????? Points

Unlock this medal to learn its secrets!

Knowledge Peeker

Knowledge Peeker 5 Points

Visit the codex for the first time.

Godfather

Godfather 50 Points

Made this to top

Traitorkiller

Traitorkiller 100 Points

Kill the traitor without loosing any power

Icecold

Icecold 50 Points

Killed another boss

UltimateCopKiller

UltimateCopKiller 10 Points

Killed the cop on first time

MrPerfect

MrPerfect 100 Points

Beat the first fight without loosing any power

The Perfect Fit

The Perfect Fit 5 Points

Operation Fit-Into-Place is successful!

I hate myself and I want to die.

I hate myself and I want to die. 25 Points

RAAAWR.

Rank PBT

Rank PBT 50 Points

You Won!

You Win!

You Win! 10 Points

Good job!

HIYA!!!!!!

HIYA!!!!!! 5 Points

Kill your enemy

There and Black Again

There and Black Again 50 Points

Watch Africa Dudes twice in a row, black to black! (Without re-loading your window!)

Latest Art