Skip to main content
Known Participant
August 15, 2008
Question

Button within a Movieclip

  • August 15, 2008
  • 3 replies
  • 373 views
This is a pretty basic question, but I don't understand how Flash handles button functions within Movie Clips that also have functions. Here is what I have...

A Movie Clip named controlBar_mc with a function like so:
controlBar_mc.onRollOver = function () {
showController();
}

controlBar_mc.onRollOut = function () {
hideController();
}

OK... now within this Movie Clip, I have a Button named play_btn with this code:
controlBar_mc.play_btn.onRelease = function () {
ns.pause ();
}

The problem is that the Movie Clip onRollOver function is overriding the Button onRelease function. How do I get around this?

Thanks,
g
This topic has been closed for replies.

3 replies

kglad
Community Expert
Community Expert
August 15, 2008
you're welcome.

as3 allows event bubbling so children and parents can have mouse event listeners.
Known Participant
August 15, 2008
I was afraid of that. Thanks, kglad.
kglad
Community Expert
Community Expert
August 15, 2008
in as1/as2, parent movieclips with mouse handlers intercept mouse events so child movieclips cannot respond.

to remedy, use a loop and hitTest for the child (or parent) and mouse handlers for the parent (or child).