# Nested array does not work

**URL:** <https://forum.kirupa.com/t/nested-array-does-not-work/324811>\
**Category:** Uncategorized\
**Created:** [September 10, 2011, 1:23am UTC](https://forum.kirupa.com/t/nested-array-does-not-work/324811 "2011-09-10T01:23:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![drpelz](https://avatars.discourse-cdn.com/v4/letter/d/c68b51/32.png) [@drpelz](https://forum.kirupa.com/u/drpelz)\
**Post date:** [September 10, 2011, 1:23am UTC](https://forum.kirupa.com/t/nested-array-does-not-work/324811/1 "2011-09-10T01:23:19Z")

</div>

Hi folks,

I have the following problem: I have this multi-level array (nested array) which contains two rows of bitmapData. Row 1:360 rotated bitmapData objects; row 2: 360 rotated and colored bitmapData objects.

I try to access row 2 but that doesn’t work. There are some mysterious error messages coming up (“TypeError: Error #1034: Type Coercion failed: cannot convert []@36d7e9e9 to flash.display.BitmapData. at BasicBlitArrayObject/updateFrame()”).

Please can someone help me out with this problem? Thank you very much.

this function rotates and colors bitmapData; the rotated bitmapData is thrown into an array and the colored bitmapData is thrown into another array; a third array is used as a level array for nesting the other two arrays inside of it

```auto

public function createColoredRotationBlitArrayFromBD(sourceBitmapData:BitmapData, inc:int, offset:int = 0, color:Number = 1, $alpha:Number = 1):Array
{
			
	tileList = [];
	tileListSec = [];
	levelArray = [tileList, tileListSec];
	var rotation:int = offset; 
			
	while (rotation < (360 + offset))
	{
		var angleInRadians:Number = Math.PI * 2 * (rotation / 360);
		var rotationMatrix:Matrix = new Matrix();
				
		rotationMatrix.translate(-sourceBitmapData.width * .5, -sourceBitmapData.height * .5);
		rotationMatrix.rotate(angleInRadians);
		rotationMatrix.translate(sourceBitmapData.width * .5, sourceBitmapData.height * .5);
				
				
		var matrixImage:BitmapData = new BitmapData(sourceBitmapData.width, sourceBitmapData.height,
									true, 0x00000000);
				
		matrixImage.draw(sourceBitmapData, rotationMatrix);
		tileList.push(matrixImage.clone());
				
				
		bitmapData = new BitmapData(matrixImage.width, matrixImage.height, true, 0x00000000);
		bitmapData = matrixImage;
				
				
		var colorMatrix:ColorMatrixFilter = new ColorMatrixFilter (
							[color, 0, 0, 0, 0,
							0, 0, 0, 0, 0,
							 0, 0, 0, 0, 0,
							 0, 0, 0, $alpha, 0]);
				
		matrixImage.applyFilter(bitmapData, bitmapData.rect, point0, colorMatrix);

				
		tileListSec.push(matrixImage.clone());
				
								
		rotation += inc;

		matrixImage.dispose();
		matrixImage = null;
		rotationMatrix = null;
		bitmapData.dispose();
		bitmapData = null;
		colorMatrix = null;
		}
			
	return(levelArray);
			
}

```

creating my rotated and colored bitmapData

```auto

animationFrames = tempBlitArrayAsset.createRotationBlitArrayFromBD($bitmapData, 1, 270);

```

here I try to access the first row of my level array (that doesn’t work; I can’t access it)

```auto

tempEnemy.animationList = animationFrames;
tempEnemy.bitmapData = tempEnemy.animationList[1][tempEnemy.frame];

```

This function is for updating the frames

```auto

public function updateFrame(inc:int, row:int = 0):void
{
	frame += inc;
		
	if (frame > animationList.length - 1){
		frame = 0;
	}
	bitmapData = animationList[row][frame];					
					
					
	}
			
}	

```

this is a line showing how the updateFrame-function is used in my game (trueRotation is 0)

```auto

tempEnemy.updateFrame(tempEnemy.trueRotation);

```
