我認爲你的問題與你的綁定有關。 BindingUtils.bindProperty
正在被給予你的panel
實例,試圖將其用於對象圖並使其不適用於垃圾收集。
bindProperty
返回一個ChangeWatcher
,當您完成該操作時,您可以使用它來取消註冊綁定。像下面這樣:
var watchers : Array = [];
var panel:SuperPanel = new SuperPanel();
panel.width = 300;
panel.height = 200;
panel.minWidth = 200;
panel.minHeight = 100;
panel.title = "My Panel " + (panelContainer.numChildren + 1);
panel.addEventListener(CloseEvent.CLOSE, function(event:CloseEvent):void{
for each(var watcher : ChangeWatcher in watchers) {
watcher.unwatch();
}
event.target.parent.removeChild(event.target);
});
watchers.push(BindingUtils.bindProperty(panel, "allowDrag", allowDragCheck, "selected"));
watchers.push(BindingUtils.bindProperty(panel, "allowResize", allowResizeCheck, "selected"));
watchers.push(BindingUtils.bindProperty(panel, "allowClose", allowCloseCheck, "selected"));
watchers.push(BindingUtils.bindProperty(panel, "allowMaximize", allowMaxCheck, "selected"));
watchers.push(BindingUtils.bindProperty(panel, "allowMinimize", allowMinCheck, "selected"));
panelContainer.addChild(panel);
此外,你還沒有覆蓋在SuperPanelEvent
的clone
事件後來會引起你的問題。 See this question for more details。
爲什麼不直接在這裏發佈代碼,而不是讓你要求幫助的人做額外的工作? – Oded 2010-02-10 08:15:28