Actionscript 3 Flex 4.0选项卡栏删除选项卡和内容
我有一个Actionscript 3 Flex 4.0选项卡栏删除选项卡和内容,actionscript-3,apache-flex,tabbar,Actionscript 3,Apache Flex,Tabbar,我有一个选项卡栏,在CTRL+ALT+单击(关闭按钮)时,我想关闭所有选项卡,并删除它们的内容 在每个选项卡的退出按钮上添加事件侦听器: public static var CONTROL_PRESSED:Boolean = false; public static var ALT_PRESSED:Boolean = false; this.tabBar.addEventListener(ChildExistenceChangedEvent.CHILD_ADD, function
选项卡栏
,在CTRL+ALT+单击(关闭按钮)时,我想关闭所有选项卡,并删除它们的内容
在每个选项卡的退出按钮上添加事件侦听器:
public static var CONTROL_PRESSED:Boolean = false;
public static var ALT_PRESSED:Boolean = false;
this.tabBar.addEventListener(ChildExistenceChangedEvent.CHILD_ADD, function(event:ChildExistenceChangedEvent):void{
var tab:SuperTab = SuperTab(event.relatedObject);
tab.addEventListener(FlexEvent.CREATION_COMPLETE, function(event:FlexEvent):void{
for(var i:int = 0; i < tab.numChildren; i+=1){
if(tab.getChildAt(i) is Button){
var exitButton:Button = Button(tab.getChildAt(i));
exitButton.addEventListener(MouseEvent.MOUSE_DOWN, function(event:MouseEvent):void{
if(event.altKey){
ALT_PRESSED = true;
}else{
ALT_PRESSED = false;
}
if(event.ctrlKey){
CONTROL_PRESSED = true;
}else{
CONTROL_PRESSED = false;
}
}, false, 1000);
model.tabExitButtonArray.push(exitButton);
}
}
});
});
for(var i:int = 0; i< model.tabExitButtonArray.length; i++){
model.tabBar.selectedIndex = i;
Class.dispatchEvent(new CustomEvent(object, function));
}
你试过移除数据提供者吗?@FlorianLavorel,我该怎么做<代码>数据提供程序=新数组()代码>?
model.tabBar.removeAllChildren();
for(var i:int = 0; i< model.tabExitButtonArray.length; i++){
model.tabBar.selectedIndex = i;
Class.dispatchEvent(new CustomEvent(object, function));
}
model.tabBar.removeAllChildren();
model.tabBar.dataProvider = new Array();