Share on Google+Share on Google+

ViewStack in Flex4

Advertisement
The ViewStack container is called Spark ViewStack container. It is made up of a collection of child containers.

ViewStack Container in Flex4:

The ViewStack container is called Spark ViewStack container. It is made up of a collection of child containers. The child containers are stacked on top of each other. Only one child container is active, visible at a time. You can use a TabBar, ButtonBar, LinkBar or ToggleButtonBar for navigate a ViewStack child container. ViewStack container uses the selectedIndex, selectedChild, munChildren property. The tag of ViewStack container is <mx:ViewStack>.

Example:

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

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

xmlns:mx="library://ns.adobe.com/flex/mx"

xmlns:s="library://ns.adobe.com/flex/spark">

<s:Panel id="pnl" title="ViewStack Container Example" width="311" height="229">

<s:VGroup x="17" y="14" height="167">

<s:ButtonBar dataProvider="{vstack}"/>

<mx:ViewStack id="vstack"

borderStyle="solid"

width="100%" height="140">

<s:NavigatorContent id="label" label="Label">

<s:Label text="Label" x="119" y="53"/>

</s:NavigatorContent>

<s:NavigatorContent id="button" label="Button">

<s:Button label="Button" x="97" y="47"/>

</s:NavigatorContent>

<s:NavigatorContent id="textinput" label="TextInput">

<s:TextInput text="TextInput" x="73" y="49"/>

</s:NavigatorContent>

<s:NavigatorContent id="textarea" label="TextArea">

<s:TextArea text="TextArea" height="89" width="107" x="90" y="25"/>

</s:NavigatorContent>

</mx:ViewStack>

</s:VGroup>

</s:Panel>

</s:Application>

In this example you can see how we can use a ViewStack container in Flex4.

Output:

Running Application:

To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed.


Download this code

Advertisements

Posted on: May 15, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.