# Buttons in a draggable Movieclip

**URL:** https://forum.kirupa.com/t/buttons-in-a-draggable-movieclip/261219
**Category:** flash
**Created:** [May 24, 2008, 2:14pm UTC](https://forum.kirupa.com/t/buttons-in-a-draggable-movieclip/261219 "2008-05-24T14:14:56Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![dsntos](https://avatars.discourse-cdn.com/v4/letter/d/67e7ee/32.png) [@dsntos](https://forum.kirupa.com/u/dsntos)
#### Post date: [May 24, 2008, 2:14pm UTC](https://forum.kirupa.com/t/buttons-in-a-draggable-movieclip/261219/1 "2008-05-24T14:14:56Z")

</div>

I have a MovieClip that has startDrag(). Inside the MC I have buttons, but when I click the buttons it wants to drag. How do I make the buttons clickable?

---

<div class="post-metadata">

### Author: ![eki](https://avatars.discourse-cdn.com/v4/letter/e/35a633/32.png) [@eki](https://forum.kirupa.com/u/eki)
#### Post date: [May 24, 2008, 5:14pm UTC](https://forum.kirupa.com/t/buttons-in-a-draggable-movieclip/261219/2 "2008-05-24T17:14:16Z")

</div>

Hi,

I’d make a kind of handle to move your movieClip ( like bars on windows) or you can disable the dragging on rolling over the buttons.

SHO

---

<div class="post-metadata">

### Author: ![stupidsaint](https://avatars.discourse-cdn.com/v4/letter/s/258eb7/32.png) [@stupidsaint](https://forum.kirupa.com/u/stupidsaint)
#### Post date: [May 24, 2008, 5:34pm UTC](https://forum.kirupa.com/t/buttons-in-a-draggable-movieclip/261219/3 "2008-05-24T17:34:29Z")

</div>

I have encountered your problem before and the way i got round it was to do the following:

1. Make the movie clip you want

2. go inside the movie clip and then make the artwork a movieclip again.

3. add the buttons but put them as movie clips

4. add the codes:

```auto

//when the clip is on the stage...
onClipEvent (enterFrame) {
    //when this is pressed...
    _root.onPress = function() {
        //this will start to drag
        _parent.starDrag();
        //then the mouse is released...
        this.onRelease = function() {
            //this will stop draggin
            _parent.stopDrag();
        };
    };
}

```

the above code should be placed on the second symbol  
stage\>group with symbols\>artwork symbol

```auto

//when the clip is on the stage
onClipEvent (enterFrame) {
    //if the mouse is pressed...
    this.onPress = function() {
        //if the mouse it pressed and moved...
        this.onMouseMove = function() {
            //start draggin
            _parent.startDrag();
            //set a global varable to true
            _global.moved = true;
        };
    };
    //when the mouse is up...
    this.onMouseUp = function(){
        //test to see if moved to true
        if(_global.moved == true){
            //if it is...
            //reset the variable to false
            _global.moved = false
            //stop the drag
            _parent.stopDrag();
            //do what you want it to do
        //otherwise...
        } else {
            //stop draggin
            _parent.stopDrag()
        }
    }
}

```

put this on the buttons

i have done this code countless times and it has worked for me, msg me if you need any help.

hope your problems are solved now,

Stupid Saint

---

<div class="post-metadata">

### Author: ![sparkdemon](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@sparkdemon](https://forum.kirupa.com/u/sparkdemon)
#### Post date: [May 25, 2008, 8:03pm UTC](https://forum.kirupa.com/t/buttons-in-a-draggable-movieclip/261219/4 "2008-05-25T20:03:06Z")

</div>

[http://www.4shared.com/file/48900566/78a25378/sol.html](http://www.4shared.com/file/48900566/78a25378/sol.html)

download this and see the fla structure

add startdrag to the parent but onPress of the invisible button
