 				var layer:Layer = new Layer();
 				for(var j:int = 0; j < m; j++){
 					var frameVO:FrameVO = timelineVO.frames[j];
-					//create mesh
-					var mesh:MeshMatrix = frameVO.matrix != null ? new MeshMatrix( 0, 0,
+					//create matrix
+					var matrix:MeshMatrix = frameVO.matrix != null ? new MeshMatrix( 0, 0,
 							frameVO.matrix.tx,
 							frameVO.matrix.ty
 							//TODO calculate scale and skew
 						) : null;
-					var index:int = mesh == null ? -1 : layer.meshes.push(mesh);
+					var index:int = matrix == null ? -1 : layer.matrixList.push(matrix) - 1;
 					var framesArray:Array = this.createFramesInfo(index, frameVO.name,
 							frameVO.duration, frameVO.type == "motion");
-					layer.frames = layer.frames.concat(framesArray);
+					layer.framesList = layer.framesList.concat(framesArray);
 				}
 				data.layers.push(layer);
 			}

		}

		private function createAnimationOutput(animationVO:AnimationVO):Object {
			var data:Object = { name:animationVO.name.substr(0, -4),// name of the mesh
				totalFrames:animationVO.totalFrames,// Total animation frames
				layers:[]};
			var n:int = animationVO.timelines.length;

	}
}
class Layer{
	public var matrixList:Array;
	public var framesList:Array;

	public function Layer() {
		this.framesList = [];
		this.matrixList = [];
	}
}

class FrameInfoData{
	public var polygonName:String;
	public var motion:Boolean;
	public var index:int;
	public var t:Number;
}