Indexed Vector Array in Action Script 3.0


 

Indexed Vector Array in Action Script 3.0

In this example, you can see how to insert value in the indexed array class instance with different data types.

In this example, you can see how to insert value in the indexed array class instance with different data types.

Insert value in Indexed Array class instance example:-

In this example, you can see how to insert value in the indexed array class instance with different data types.

Example:-

<?xml version="1.0" encoding="utf-8"?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

xmlns:s="library://ns.adobe.com/flex/spark"

xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="init();">

<fx:Script>

<![CDATA[

import mx.controls.Text;

public function init():void{

var arr:Array = new Array();

arr[0] = "a";

arr[1] = 5;

arr[2] = 5.8;

arr[3] = true;

for(var i:uint = 0; i<arr.length; i++){

var text:Text = new Text();

text.text = arr[i];

myVBox.addElement(text);

}

}

]]>

</fx:Script>

<s:Panel width="200" height="160" title="Array Class Insert example" backgroundColor="0xEEFFEE">

<s:VGroup id="myVBox">

<mx:Text text="Array values" fontWeight="bold"/>

</s:VGroup>

</s:Panel>

</s:Application>

0

  In this example we have create a Array class instance. You use the array access ([]) operator to specify the index position of the element you wish to access or insert in the array. After that we have insert values that have different data types with the help of access operator and after that we have access that array for retrieve these values.

Output:-

1

Download this code

Ads