# Close Button

**URL:** <https://forum.kirupa.com/t/close-button/50474>\
**Category:** flash\
**Created:** [May 3, 2004, 1:49pm UTC](https://forum.kirupa.com/t/close-button/50474 "2004-05-03T13:49:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bellyboy](https://avatars.discourse-cdn.com/v4/letter/b/c68b51/32.png) [@bellyboy](https://forum.kirupa.com/u/bellyboy)\
**Post date:** [May 3, 2004, 1:49pm UTC](https://forum.kirupa.com/t/close-button/50474/1 "2004-05-03T13:49:28Z")

</div>

hi, the button on the window component doesnt seem to do anything, how do i get the window to unload when it clicked…anyone know please?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 4, 2004, 10:04am UTC](https://forum.kirupa.com/t/close-button/50474/2 "2004-05-04T10:04:52Z")

</div>

hi, i cant attach my file it is too big, i have attached a screen shot of what my file looks like, it is simply a window component, with a swf file as ts content. this is the exact code i have on the component  
\code  
on (release) {  
var window = PopUpManager.createPopUp(\_root, Window, false);  
windowClickListener = new Object();  
windowClickListener.click = function(evt){

Window.deletePopUp();

}  
Window.addEventListener("click ",windowClickListener);  
}  
\

if i dont put  
on(release) or on(click) i get errors saying must appear within a statemnet…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 4, 2004, 1:37pm UTC](https://forum.kirupa.com/t/close-button/50474/3 "2004-05-04T13:37:06Z")

</div>

here are the errors i keep getting with your code, sorry to be a pain!

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 1: Statement must appear within on/onClipEvent handler  
var my\_window = PopUpManager.createPopUp(\_root, Window, false);

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 2: Statement must appear within on/onClipEvent handler  
my\_Listener = new Object();

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 3: Statement must appear within on/onClipEvent handler  
my\_Listener.click = function() {

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 6: Statement must appear within on/onClipEvent handler  
my\_window.addEventListener(“click”, my\_Listener);

Total ActionScript Errors: 4 Reported Errors: 4

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 4, 2004, 2:31pm UTC](https://forum.kirupa.com/t/close-button/50474/4 "2004-05-04T14:31:48Z")

</div>

dude , this code doesn;t go dorectly on the component . it goes on a layer ,call the new layer actions or script or code …  
as you can see we are working here with a var : and instancename , i even wrote in my last post

//instancename = “my\_window”

pu att this code on another layer …  
not on the component .

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 4, 2004, 3:36pm UTC](https://forum.kirupa.com/t/close-button/50474/5 "2004-05-04T15:36:23Z")

</div>

im sorry, im rubbish a programming\scripting etc, useless, i have done that now, thanks very much for your patience and help.
