1. Computing & Technology

Discuss in my forum

Matrix

By , About.com Guide

Definition: A matrix is a rectangular array with an extra dimension added; where a normal array is a list, a matrix is defined by X rows across and Y columns down with information stored in its correct row and column.

Example:

4 3 1
6 8 9
2 5 3

Above is a 3x3 matrix storing 9 numbers.

In ActionScripting, Flash uses matrices as part of the transformation matrix, which can be either a 3x3 matrix in which values are taken from an array in the format:

a b c
d e f
g h i

and read in the order:

matrix = { a:20, b:30, c:40, d:50, e:60, f:70, g:80, h:90, i:100 };

Or the matrix can be defined as a matrix type:

matrix = { matrixType:"box", x:300, y:300, w:100, h:250, r:(90/180)*Math.PI };

in which the values, instead of being taken from a 3x3 storage array, are instead assigned to preset values for that type. For instance, a box type matrix needs an x and y coordinate, a width and height, and in this case a radius (when being used for a gradient fill).

Transformation matrices are used most often in the begingradientfill function.

©2012 About.com. All rights reserved.

A part of The New York Times Company.