By now, our Website skeleton is finished. The full code should look like the following one:

package {
   
    import org.flashapi.swing.*;
    import org.flashapi.swing.databinding.*;
   
    public class WebSite extends Application {
       
        public function WebSite():void {
            super(main);
        }
       
        private var _menuData:XMLQuery;
        private var _mainPage:Box;
        private var _compName:Heading;
        private var _header:Canvas;
        private var _menu:LinkBar;
        private var _linkCont:Panel;
        private var _textContent:Text;
        private var _footerCont:Box;
        private var _copyright:Label;
       
        private function main():void {
            this.waitForStyleInit("template/style.css", createUI);
        }
       
        private function createUI():void {
            _mainPage = new Box();
            _mainPage.id = "mainPage";
            _compName = new Heading("Your Company");
            _compName.id = "compName";
            _header = new Canvas();
            _header.id = "header";
            _header.addElement("template/header.gif");
            _linkCont = new Panel();
            _linkCont.id = "linkCont";
            _menu = new LinkBar();
            _linkCont.addElement(_menu);
            _textContent = new Text();
            _footerCont = new Box();
            _footerCont.id = "footerCont";
            _copyright = new Label("\u00A9 2010, Your Company.");
            _copyright.id = "copyright";
            _footerCont.addElement(_copyright);
            _mainPage.addGraphicElements(_compName, _header, _linkCont, _textContent, _footerCont);
            this.addElement(_mainPage);
            this.populateMenu();
        }
       
        private function populateMenu():void {
            _menuData = new XMLQuery();
            _menu.xmlQuery = _menuData;
            _menuData.load("menu.xml");
        }
    }
}

Once it has been compiled, your web site should look like this one: Full Flash Website

What is next?

As mentioned at the beginning of this tutorial, the next article will discuss about how to render text content with the Text Layout Framework exactly as we could do with an HTML basic Website.

Sample source code

The sample source code for this tutorial is available from the original artical published at : FlashApi.org