PDA

View Full Version : trouble w/BTN nested in MC



pspecial
April 13th, 2004, 03:53 PM
How can I get a button to work when its nested in a MC that has an onEnterFrame with a onPress command targeted to it??

Here's the code for my "popup" MC located on the main timeline.

popup.onEnterFrame = function(){
this.onPress = function() {
this.startDrag(false);
}
this.onRelease = function() {
this.stopDrag();
}
}


Within that same MC is a button that tells it to close. However, I run a trace command to it and nothing happens. It seems like the onPress nested in the onEnterFrame is over-riding my button on(press).

How can I work around this?

claudio
April 13th, 2004, 04:10 PM
Create an invisible button inside the popup mc that covers the whole mc and use this code:
popup.invisiblebutton.onPress = function() {
this._parent.startDrag(false);
};
popup.invisiblebutton.onRelease = function() {
this._parent.stopDrag();
};

pspecial
April 13th, 2004, 05:35 PM
thanks Claudio, your always a big help.

claudio
April 13th, 2004, 08:50 PM
welcome :)