Tutorials, extensions, and source files for ActionScript, Flash, and other Adobe products.


AS3: Layout class for Flash CS3

Posted August 01, 2007 by senocular

One thing that a lot of Flash users like about Flex is its use of constraints in laying out a design. This class - rather, a collection of 3: Layout, LayoutConstraint, and LayoutManager - provide that functionality to objects in Flash CS3 through ActionScript 3 using a somewhat similar API (though ActionScript only, no authoring interface). Using these classes you can constrain objects to the top, right, bottom, left, or center them horizontally or vertically within a layout. There are also controls for height and width as well as a property for maintaining aspect ratio.

I have created a number of examples demonstrating the use of the classes, all of which can be found on the download/demo page.