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

jockmahon01Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Antonio EstradaTech Leader / Senior Web DeveloperCommented:
Try this instead:

<code snippet>

Good Luck
-V
var fullArray:Array = new Array();
var splittedArray:Array = new Array();
 
for(i=0;i<=96;i++) {
	fullArray[i] = i+1;
}
 
splitArray(fullArray);
 
function splitArray(temp:Array):Void {
	count = 0;
	arrNum = 0;
	var tempArray:Array = new Array();
	for(i=0;i<=fullArray.length-1;i++) {
		tempArray[count] = fullArray[i];
		if(count<20) {
			count++;
		} else {
			splittedArray[arrNum] = tempArray;
			var tempArray:Array = new Array();
			count = 0;
			arrNum++;
		}
	}
	splittedArray[arrNum] = tempArray;
}
 
trace("Array 1: " + splittedArray[0]);
trace("Array 2: " + splittedArray[1]);
trace("Array 3: " + splittedArray[2]);
trace("Array 4: " + splittedArray[3]);
trace("Array 5: " + splittedArray[4]);

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jockmahon01Author Commented:
Great thanks this got me out of a bind, thanks for the quick reply
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.