Pages
A page is a xml structure that you use inside the boot.xml. It consists of assets and modules. An example page would look like this:
<Page> <Assets> <!-- add your assets here --> <XML path="external.xml" id="myXML" /> </Assets> <Modules> <!-- add your modules here --> <Module class="MyTestModule" /> </Modules> </Page>
As the assets of a page has to be loaded before the modules can be displayed a PageLoader is used to load and display the page. In the boot.xml this looks like this;
<PageLoader> <Page> <Modules> <Module class="MyTestModule" /> </Modules> </Page> </PageLoader>
Probably this looks familiar to you because in the boot.xml the ModularApplication is nothing more than a normal PageLoader.
As the PageLoader itself is a module you can build up nested pages like this:
<ModularApplication> <Page> <Modules> <PageLoader> <!-- here starts my nested page --> <Page> <Modules> <Module class="MyTestModule" /> </Modules> </Page> </PageLoader> </Modules> </Page> </ModularApplication>
Further more you can specify an id for the PageLoader and use it as a container to load different pages.
<ModularApplication> <Page> <Modules> <!-- this is my container were you load pages --> <PageLoader id="content" x="200" width="400" /> </Modules> </Page> </ModularApplication>
Now you can pass a page from actionscript to the PageLoader as the following snippet shows:
// modular returns you the pageloader with the id: content var pageLoader:PagerLoader = Modular.getModule( "content" ); // create the page content var pageXML:XML = <Page> <Modules> <Module class="MyTestModule" /> <Modules> </Page>; var myNewPage:Page = new Page( pageXML ); // this loads now my in as3 created page in the pageloader. pageLoader.load( myNewPage );
Have a look on the common modules because there is a navigation module that handles loading of multiple pages into a target pageloader.
Comments