How To Use Marmot Layout Manager
Contents
About this Document
This document is a guide to the Marmot Layout Manager which introduced by the Marmot Flash Frontend.
Overview
Marmot Layout Manager implements a mechanism for Flash Actionscript 3 projects to deal with the layout stuff.
Marmot Layout Manger forcuses on reducing the coupling between business layer and presentation layer for the projects implemented without using flex things(like flex libraries or .mxml files).
Classes and Concepts
Classes
- LayoutManager a static class using for providing a interface for DisplayObject(such as Sprite, MovieClip) to call the Layouters. It contains following function members:
- Layouter a interface of classes which is resiponsible for layouting some specific "class". A Layouter have to be registered in LayoutManager before using.
Concepts
- Class a class means a series of DisplayObject which has the similar layout strategy using the same Layouter to do the layout stuff.
How to use
First of all, you should write your Layouters.
And you should use the Marmot Layout Manager following these steps:
- You should register the Layouters before you use it. Like LayoutManager.register("MainFrame", MarmotMainFrameLayouter);
- You should place the code LayoutManager.layout("MainFrame", this) in the constructor of your implement of DisplayObject(like Sprite) or using like this
fooInput = new TextField();
LayoutManager.layout("FooInput", fooInput);
- You could make the Layouters adjust their parameters to adapt the new stage size by call LayoutManager.adjustAll() or LayoutManager.adjust(), like you can place this code in the resize event handler of the stage.
For More Information
Please contact the author Wenyuan Yu,
wenyuany@googlePLEASENOSPAM.com