Creating columns using ActionScript

The MulticolumnTextField component resides on the stage like a movie clip and provided you give it an instance name, it can be referenced through ActionScript.

The component has all the properties of standard movieclips such as _x, _y _xscale etc. In addition, it has numerous properties of its own. The following example manipulates the instance named 'myInstance' using ActionScript.

//assign content to columns
myInstance.mtftext = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer...";
//provide an array of x positions
myInstance.mtfx = [0, 200, 400];
//provide an array of y positions (third value will become 0 at run time)
myInstance.mtfy = [50, 0];
//provide array of heights (all values become 200 at run time)
myInstance.mtfheight = [200];
//provide width of colums
myInstance.mtfwidth = 200;
//specify maximum number of columns
myInstance.mtfmaxcolumns = 3;


Note:

The content specified in this example would not be sufficient to cause the creation of more than one column, it has been reduced in size for the purposes of demonstration.

You can also apply style to your columns using ActionScript; for full details see Integration with the Text Format object.

For a full list of all the Multicolumn Text Field components methods and properties see the Reference section.