Nested array does not work

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


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


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)


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

This function is for updating the frames


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)


tempEnemy.updateFrame(tempEnemy.trueRotation);