Tag: flash as2 actionscript 2.0 event handlers buttons nested buttons movieclips

ActionScript 2: Nested button events

Sometimes it’s helpful to have a quick reminder of how button events work within nested clips in ActionScript 2.

[ TRY DEMO ]

A button nested inside another button OR inside a MovieClip that has buttonEvents assigned to it will not work. (Button events include: onRollOver, onRollOut, onDragOver, onDragOut, onPress, onRelease and onReleaseOutside).

This is due to the way Flash captures events: the first parent instance with a button event handler assigned to it is the one that is listened to. None of its child objects will be listened for unless you use a workaround.

Continue reading