# Help needed: startDrag/stopDrag function prevents closing popup window

**URL:** <https://forum.kirupa.com/t/help-needed-startdrag-stopdrag-function-prevents-closing-popup-window/203882>\
**Category:** flash\
**Created:** [October 15, 2006, 6:30am UTC](https://forum.kirupa.com/t/help-needed-startdrag-stopdrag-function-prevents-closing-popup-window/203882 "2006-10-15T06:30:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bleeksano](https://avatars.discourse-cdn.com/v4/letter/b/73ab20/32.png) [@Bleeksano](https://forum.kirupa.com/u/Bleeksano)\
**Post date:** [October 15, 2006, 6:30am UTC](https://forum.kirupa.com/t/help-needed-startdrag-stopdrag-function-prevents-closing-popup-window/203882/1 "2006-10-15T06:30:28Z")

</div>

[FONT=Verdana]Hey all,

**Summary:**

I created a popup window inside my flash movie and it worked fine.  
Then I decided that the user should have the ability to drag the window around if needed.  
So, I added a startDrag/stopDrag function to it.

**Problem:**

Because I added the startDrag function, I can’t close the popup window.  
If I comment the drag function out, then I can close the window.  
I can do one or the other, but not both.

I have a vague idea of what’s happening.

**Theory:**

The close window command ( t.[COLOR=Blue]removeMovieClip/COLOR ) is not able to execute because  
the “_close button movie clip_” is inside the popup window movie clip. Therefore, when I add the [COLOR=Blue]startDrag [/COLOR]function, it gets dragged along with everything else. I believe that to  
sovle this problem the [COLOR=Blue]startDrag [/COLOR]function has to be cleared some sort of way  
so that the [/FONT][FONT=Verdana]“_close button movie clip_”[/FONT][FONT=Verdana] can perform its function.

Well that’s just my theory.

Here is my **[COLOR=Blue]code[/COLOR]**:

[/FONT]

```auto
//-----------------------This creates an empty movie clip----------------------\\

[COLOR=Blue]this.createEmptyMovieClip[/COLOR]([COLOR=SeaGreen]"container_mc"[/COLOR],1);

//-----------------------end of movie clip creation----------------------------\\

//-------------This attaches movie clip to stage on button release-------------\\

button.[COLOR=Blue]onRelease[/COLOR] = f[COLOR=Blue]unction[/COLOR] () {
    [COLOR=Blue]var[/COLOR] t:[COLOR=Blue]MovieClip[/COLOR] = container_mc.[COLOR=Blue]attachMovie[/COLOR]([COLOR=SeaGreen]"popup"[/COLOR],[COLOR=SeaGreen]"pop_mc"[/COLOR],container_mc._level1());
    t.[COLOR=Blue]_x[/COLOR] =100;
    t.[COLOR=Blue]_y[/COLOR] =100;
    t.closer.onRelease = function () {
         t.[COLOR=Blue]removeMovieClip[/COLOR]();
}

//---------------------end attach movie--------------------------------------\\

//--------------------drag events--------------------------------------------\\

t.[COLOR=Blue]onPress[/COLOR] = [COLOR=Blue]function[/COLOR] () {
    t.[COLOR=Blue]startDrag[/COLOR]();
}

t.onRelease = function () {
    t.s[COLOR=Blue]topDrag[/COLOR]();
}

//----------------------------end drag events------------------------------\\

}

```

## I have attached the **[COLOR=Red]fla[/COLOR]** file.

Thanks in advance.

[COLOR=Blue]Hungry[/COLOR] [COLOR=Red]Samurai[/COLOR]  
[FONT=Verdana]

[/FONT]
