topical media & game development
professional-flex-code-12-TemplateLayoutComp.mx
professional-flex-code-12-TemplateLayoutComp.mx
[swf]
flex
<?xml version="1.0"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init();" width="100%" height="100%">
<mx:Script>
<![CDATA[
import mx.containers.HBox;
import mx.core.UIComponent;
// Define a property for components
public var header:UIComponent;
public var menu:UIComponent;
public var footer:UIComponent;
// Define an Array of elements for the mainContent
// components of type mx.core.UIComponent.
[ArrayElementType("mx.core.UIComponent")]
public var content:Array;
private function init():void {
// Add the header component
this.addChild(header);
// Create an HBox container. This container
// is the parent container of the bottom row of components.
var body:HBox= new HBox();
body.percentHeight=100;
body.percentWidth=100;
addChild(body);
body.addChild(menu);
var mainContent:VBox = new VBox();
mainContent.percentHeight=100;
mainContent.percentWidth=100;
// Loop through the content Array and add components to mainContent section
for (var i:int = 0; i < this.content.length; i++){
mainContent.addChild(this.content[i]);
}
// Add the body
body.addChild(mainContent);
// Add the footer
this.addChild(footer);
}
]]>
</mx:Script>
</mx:VBox>
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.