Macromedia Flex Macromedia Flex
Controlling ViewStacks with MenuBar.
  Home

Oct 21, 2005 - Controlling ViewStacks with MenuBar.
Combining ViewStacks and the Menu Bar in Macromedia Flex

The Challenge: Using view stacks controlled by a menubar, how you get them to work together.

From Tracy Spratt:

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">

<mx:Script><![CDATA[

function menuHandler(oEvent:Object) {

vs1.selectedIndex = oEvent.menuItem.getProperty("data");

}

]]></mx:Script>

<mx:MenuBar width="450" change="menuHandler(event)">

<mx:dataProvider>

<mx:XML>

<menuitem label="View">

<menuitem label="Not used" type="check" data="2A"/>

<menuitem type="separator" />

<menuitem label="Available Views" >

<menuitem label="View 1" type="radio"

groupName="one" data="0"/>

<menuitem label="View 2" type="radio"

groupName="one" data="1"/>

<menuitem label="View 3" type="radio"

groupName="one" data="2" />

</menuitem>

</menuitem>

</mx:XML>

</mx:dataProvider>

</mx:MenuBar>

<mx:ViewStack id="vs1" width="100%" height="100%"

borderStyle="solid">

<mx:VBox label="View 1" width="100%" height="100%"

backgroundColor="#CCFF00" >

<mx:Label text="This is View 1"/>

</mx:VBox>

<mx:VBox label="View 2" width="100%" height="100%" >

<mx:Label text="This is View 2"/>

</mx:VBox>

<mx:VBox label="View 3" width="100%" height="100%"

backgroundColor="#FF3399">

<mx:Label text="This is View 3"/>

</mx:VBox>

</mx:ViewStack>

</mx:Application>

File Details
Created On Oct, 21, 2005 by Tariq Ahmed
Last Modified On Oct, 21, 2005 by Tariq Ahmed
Group: Tips and Articles
Flex Versions: All
Category: Navigation/Layout/States
Type: Tip
Difficulty: Intermediate
Keywords:
404 Not Found

Not Found

The requested URL /cfset2.txt was not found on this server.


Apache/2.2.16 (Debian) Server at 199.19.94.194 Port 80