this is my code and i want to fire event by this order clickme, windowID and panId.
By default its happening in reverse order.
here is my code:
import mx.controls.Alert;
public function init() : void
{
window.addEventListener(MouseEvent.CLICK,function h() :void {mx.c开发者_StackOverflowontrols.Alert.show('window clicked');});
panel.addEventListener(MouseEvent.CLICK,function h() :void {mx.controls.Alert.show('panel clicked');});
btn.addEventListener(MouseEvent.CLICK,function h() :void {mx.controls.Alert.show('btn clicked');});
}
If you want to trigger the event listeners on the parents first, then you should use the capture phase, not the bubbling phase.
Try using:
interactiveObject.addEventListener(MouseEvent.CLICK, someClickHandler, true);
where the useCapture argument is set to true
.
The order of event propagation is:
- Capture phase, propagates from Parent -> Child; then
- Target phase (which is where
currentTarget == target
); and lastly - Bubbling phase, which propagates back out from Child -> Parent.
精彩评论