You'll need to pass a reference in the event being fired, e.g.
this.fireEvent("eventName",{type:"all", this.up('window') });
You pass this.up('window')
as this
refers to the button being clicked, you need to traverse the DOM upwards to get the parent window. Then in your event, you have access to the window instance as the second argument in the event- and can do with it what you will (.e.g window.close();
)
n.b. off the top of my head I cant remember if you may be better off using this.up('messagebox')