Link to home
Start Free TrialLog in
Avatar of jockmahon01
jockmahon01Flag for United States of America

asked on

Arrrays problem

i have this code, bacausally i have a big array of items and i want to seperate it down into an array or arrays so instead of having an array with 97 items i would have an array with 5 items each is an array with a max of 20 items

index 0 - 20 items (0- 19)
index 1 - 20 items (19 - 40)
index 2 - 20 items (41 - 60)
index 3 - 20 items (61 - 80)
index 4 - 20 items (81 - 97)

this code works if i just put a simlpe value in ie

seperateItemsArray[itemIndex][h]= i  ;

but if i try to put in a array

seperateItemsArray[itemIndex][h]= details[i]  ;

it just goes blank

help

var itemsArray:Array = new Array();
	
	var seperateItemsArray:Array = new Array();
	var itemIndex:Number= 0;
	var h=0;
	
	seperateItemsArray[itemIndex] = new Array();
	
	
	for(var i:Number = 0 ; i < details.length ; i++)
	{
		
		if(h < 20)
		{
			//seperateItemsArray[itemIndex][h] = new Array();
	
			seperateItemsArray[itemIndex][h]= details[i]  ;
			
			
			h++;
		}
		else
		{
			h = 0;
			itemIndex++;
			seperateItemsArray[itemIndex] = new Array();
		}
	}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Antonio Estrada
Antonio Estrada
Flag of Mexico image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jockmahon01

ASKER

Great thanks this got me out of a bind, thanks for the quick reply