ViewStack is ususlly connected with LinkBar

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
import mx.events.ItemClickEvent;
private function clickHandler(event:ItemClickEvent):void {
mx.controls.Alert.show(String(event.index) + "/" + event.label);
}
</mx:Script>
<mx:Panel title="Navigation Containers" height="90%" width="90%" >
<mx:LinkBar fontWeight="bold" dataProvider="{myVS}" itemClick="clickHandler(event);"/>
<mx:ViewStack id="myVS" borderStyle="solid" width="100%" height="80%">
<mx:Canvas id="A" label="A" width="100%" height="100%">
<mx:Label text="A" color="#000000"/>
</mx:Canvas>
<mx:Canvas id="B" label="B" width="100%" height="100%">
<mx:Label text="B" color="#000000"/>
</mx:Canvas>
</mx:ViewStack>
</mx:Panel>
</mx:Application>
Related examples in the same category