Home Tutorial Flex Flex4 Flex Arrays

 
 

Flex Arrays
Posted on: April 19, 2010 at 12:00 AM
Advertisement
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();

Advertisement

Related Tags for Flex Arrays:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 19, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com