Sunday, May 20, 2012

[Action Script] Get specified Array items May,2012

Hello all,

I need a favor,

Q:How to get a group of an Array specified item, and then show it in a cell of DataGrid?

The problem looks like this:

I have an array:
ActionScript Code: var arr:Array=new Array('1','2','3','4','5');
and a DataGrid:
ActionScript Code: var dg:DataGrid=new DataGrid();dg.columns=["Col1","Col2"];
I want to add a group of specified arr Array to Col1 and Col2:

Col1 data will be = 1,4,5
Col2 data will be = 1,2,4

It's not like 'push', 'splice', 'slice','shift', etc. I just want to simply gathered a single array item with another to be a group in DataGrid as an Item. It should be like this:

dg.addItem({Col1:arr[0] and arr[3] and arr[4], Col2:arr[0] and arr[1] and arr[3]});

Can we do that? If we can, how to write the code correctly?

Thanks for your help!
:cool:
Get specified Array items

Related Post



0 comments: