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

 

AS3: Layout classes update

Posted October 02, 2008 by senocular

I've just posted updated Layout classes. The primary change includes a fix taking care of an ambiguous error when used with newer compilers, notably CS4/Flash Player 10. There have been some other updates as well such as a new maintainAspectRatioPolicy property that determines how constrained scaling is applied to objects whose aspect ratio is being retained. The 4 options are favorWidth, favorHeight, favorLargest, and favorSmallest - each of which have respective constants in the LayoutConstraint class.
I'm still not 100% super-satisfied with the classes. They do their job, but I'd still like them to be easier to use. I may update them further if/when I figure out a way to accomplish this. In the mean time, I have updated an init() method that accepts a generic object whose properties will be copied into a layout, not unlike the init parameter in AS2's attachMovie. I think that adds a certain level of easy to layout definitions at least.