Basic Tabbed-Menu / View Stack Flex App Structure

Just some quick notes on setting up a basic Flex app that encapsulates individual page content (views). This could work for a multi-tab widget or a simple microsite.

Here’re some ways to interact w/ the View Stack:

Simple ViewStack switching by id
Selecting a view in a ViewStack just by its Class

To replace the views with your own custom .mxml files, check out at least the first 7 minutes of the Cairngorm Part 2 video here. It ends up looking like this:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
    xmlns:view="view.*" 
    layout="vertical" >

//....
<mx:ViewStack id="yourID" width="100%" height="100%">
<view:YourPage1 />
<view:YourPage2 />
</mx:ViewStack>
//...

Note, the extra namespace at the top, “xmlns:view”, and make sure that directory actually exists in your source folder. The “view” directory is where YourPage1.mxml and YourPage2.mxml should be stored.

Advertisements