# Can't close the Window Component.. Help!

**URL:** <https://forum.kirupa.com/t/cant-close-the-window-component-help/106623>\
**Category:** Uncategorized\
**Created:** [April 7, 2004, 12:58pm UTC](https://forum.kirupa.com/t/cant-close-the-window-component-help/106623 "2004-04-07T12:58:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![markP](https://avatars.discourse-cdn.com/v4/letter/m/b3f665/32.png) [@markP](https://forum.kirupa.com/u/markP)\
**Post date:** [April 7, 2004, 12:58pm UTC](https://forum.kirupa.com/t/cant-close-the-window-component-help/106623/1 "2004-04-07T12:58:24Z")

</div>

I’m creating a new window with the window component and it opens fine but I can’t get it to close. I’m not sure if I’m not opening it right or the code to close it is wrong… or maybe a bug?  
Can someone please take a look at the code and let me know what I’m doing wrong here.

// open new window for charts  
openWinListener = new Object();  
openWinListener.change = function(eventObject) {  
newWindow = mx.managers.PopUpManager.createPopUp(\_root, mx.containers.Window, false, {title:tfStats\_list.selectedItem.label, contentPath:statsUrlHolder\_label.text, closeButton:true});  
newWindow.setSize(300,200);  
pBar.source = newWindow;  
};  
\_root.tfStats\_list.addEventListener(“change”, openWinListener);  
//  
//close charts window  
closeWinListener = new Object();  
closeWinListener.click = function() {  
\_root.newWindow.deletePopUp();  
}  
newWindow.addEventListener(“click”, closeWinListener);
