Flash Grid Layout Example

In the example below, there is a Grid LayoutManager populated with circles. Unlike the first example, this example has the property useFixedSizes set to true. In the text boxes, you can change the width and heights of the columns and rows by entering in either a number, or a percent (e.g. 34%).

The magic functions, previously undocumented, are setRowSizes, and setColSizes

layoutManager = new GridLayout_3_0(this, 3, 4); // root_mc, rows, cols
layoutManager.x = 0;
layoutManager.y = 0;
layoutManager.width = 500;
layoutManager.height = 400;
layoutManager.useFixedSizes = true;
layoutManager.setRowSizes(23, 43, "24%");

These methods are overloaded.
Usage 1:
setRowSizes(23, 43, null, "24%");
This will set row 1 to 23px, 2 to 43px, 4 to 24% of remaining space, and rows 3 and any rows after 4 will share the remaining space evenly.

Usage 2:
var my_arr:Array = [23, 43, null, "24%"];
setRowSizes(my_arr);
Same as usage 1, just using an array instead of multiple arguments.

Usage 3:
setRowSizes(23);
This will set every row to 23 pixels. (Can also use a percent, or null to distribute all space evenly.)

The same overloading applies to the method setColSizes.

For a simple introduction to my layout managers, click here.

Darn it all...
Make sure javascript is enabled and you have an up-to-date version of flash.

Get Adobe Flash player

AttachmentSize
layoutManagersExample2.zip22.06 KB
layoutManagersSrc2.zip19.64 KB


Post new comment

CAPTCHA
Are you human?
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.