0

I want do to the next one in flash with ActionScript 3.0:

  1. Global event (if user click in any part of the screen by mouse):

addEventListener (MouseEvent.CLICK, nextc);

function nextc (event:MouseEvent): void

{nextFrame();}

  1. Button event (if user click exact this button):

returnb54.addEventListener(MouseEvent.CLICK, returnb54a);

function returnb54a(event:MouseEvent):void

{prevFrame();}

But on the frame with this a global event and a button nothing happens when clicking the button.

Is there any way to prioritize button event over global?

Thank you.

1 Answer 1

0

I created a very simple application to test your question (I'm using the same names as you defined, to be easier to understand).

I have changed 3 points:

1-

  this.stage.addEventListener (MouseEvent.CLICK, nextc);

2-

  function returnb54a(event:MouseEvent):void
  {
      event.stopImmediatePropagation();
      prevFrame();
  }

3-

  function nextc(event:MouseEvent): void
  {
     event.stopImmediatePropagation();
     nextFrame();
  }

The method: stopImmediatePropagation() prevents processing of any event listeners in the current node and any subsequent nodes in the event flow. This method takes effect immediately, and it affects event listeners in the current node. In contrast, the stopPropagation() method doesn't take effect until all the event listeners in the current node finish processing.

Try to implement these changes and see if will have the desired result.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.