<mx:XMLList id="menubarXML" >
<menuitem label="Menu1" data="top">
<menuitem label="MenuItem 1-A" data="1A"/>
<menuitem label="MenuItem 1-B" data="1B"/>
</menuitem>
private function addTab(label:String,data:String):void{
var child:Container;
switch(data){
case "1A":
child=tabMap.get("1A") as Container;
if(child==null){
child=new VBox();
child.id="1A";
child.label = label;
child.icon = document_icon;
mainVS.addChild(child);
tabMap.put(child.id.toString(),child);
}
break;
private function closeTab(event:SuperTabEvent):void{
var tabIndex:int=event.tabIndex;
tabMap.remove(event.target.getChildAt(tabIndex).id.toString());
}
<mx:VBox width="100%" height="100%" >
<mx:HBox width="100%" backgroundColor="#ACACAC" backgroundAlpha="0.5">
<mx:MenuBar labelField="@label" dataProvider="{menuBarCollection}" itemClick="menuHandler(event);" width="100%" height="26"/>
<mx:TextInput width="100%" maxWidth="200"/>
</mx:HBox>
<flexlib:SuperTabNavigator id="mainVS" scrollSpeed="25" dropShadowEnabled="true" paddingTop="5"
stopScrollingEvent="{MouseEvent.MOUSE_UP}" startScrollingEvent="{MouseEvent.MOUSE_DOWN}"
width="100%" height="100%" horizontalGap="0" closePolicy="{SuperTab.CLOSE_ROLLOVER}"
creationComplete="{mainVS.setClosePolicyForTab(0, SuperTab.CLOSE_NEVER);}" tabClose="closeTab(event);">
<mc:HomeConsole width="100%" height="100%" label="首页>
</flexlib:SuperTabNavigator>
</mx:VBox>
private function initCollections():void {
menuBarCollection = new XMLListCollection(menubarXML);
}