Home Tutorial Flex Flex4 Flex Arrays

 
 

Flex Arrays
Posted on: April 19, 2010 at 12:00 AM
An array is a collection of elements. These elements can be accessed by indexing starting from 0.
An array is a collection of elements. These elements can be accessed by indexing starting from 0. Flex provides Array class to work with arrays. Array can store dissimilar type of elements like string, number etc.

Declaration and assignment simultaneously:

var myArray:Array = {"RoseIndia", 10, new MyClass()};


Declaration and assignment separately:

var myArray:Array = new Array();

myArray[0] = "RoseIndia";

myArray[1] = 10;

myArray[2] = new MyClass();


You can add any element to the end of the array using push() method and remove the last element by pop() method.

//push() adds the element in the last of the arraymy
Array.push(
"RoseIndia");

// pop() removes the last element from the array.
myArray.pop();

Related Tags for Flex Arrays:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.