Question about startDrag and buttons

Well I’ve read that you cannot use startDrag() on a button instance… and to accomplish this you must put the button instance inside a movieclip. And you place the following actions on the button instance…

on (press) {
startDrag(this);
}

on (release) {
stopDrag();
}

…and it all works fine. What my question is…

When you specify “this” inside the startDrag prototype (or method, or whatever it’s called), does the script actually drag the button instance, or the entire movieclip that contains the button instance?

My understanding of “this” is that it applies to whatever it’s used in. For example, we used it in the button instance, so in my head that means the script is dragging the button instance. But if that’s true, why does it require you to put the button inside of a movieclip?

I hope I made sense… This is all just out of curiosity.

Matt

the thing is… all the scripts in the Button actions, are referenced to the timeline containing the Button.

no matter if you use this, the whole MovieClip is dragged.

however, you can drag it using this script:

myButton.onPress = startDrag;
myButton.onRelease = stopDrag;

being myButton the instance name of the Button. :wink: