Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8688467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:22:25+00:00 2026-06-12T23:22:25+00:00

When an event is dispatched by a component, there are three phases in which

  • 0

When an event is dispatched by a component, there are three phases in which the event flows, capture – event flows from the application to the component which dispatches the event, target when the event is at the Target which actually dispatches the event , then the bubbling phase in which the event flows from the target to the application. There is a situation in which Application has child comp1 , comp1 has child comp2. I have a button in the comp1 which dispatches the event and I want to listen to that event inside the comp2. Ideally the event would flow from Application->comp1->button->comp1->Application. How can I achieve my objective?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T23:22:27+00:00Added an answer on June 12, 2026 at 11:22 pm

    Inside comp1 dispatch your event and make sure it bubbles:

    myButton.addEventListener(MouseEvent.CLICK, handleMyButtonClick);
    
    private function handleMyButtonClick(event:MouseEvent):void {
         dispatchEvent(new Event("myCustomEvent", true));
    }
    

    Now inside comp2 listen for this event on the stage:

    stage.addEventListener("myCustomEvent", handleMyCustomEvent);
    

    That’s it: because the event bubbles, it will always at some point hit the stage. So you can use it to listen from anywhere. Just don’t forget to make sure the stage property of comp2 is set before you try to attach a listener.

    Note: be aware that all components in your application will be able to see this event, so make sure that the right component handles the right event. For starters I would never use this approach with built-in events; only use custom events whose types do not coincide with the built-in ones.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I Need to catch an event in itemrenderer component dispatched from its parent i.e
I tried to dispatch a custom event from some component on the stage and
I am using an external component which periodically shoots events from a worker thread.
So basically I have a component with my event dispatched: <components:MyComp id=Id myDispatchedEvent(event)/> In
I have event manager process that dispatches events to subscribers (e.g. http_session_created, http_sesssion_destroyed). If
I have a component that, on creation, dispatches two events to populate data fields.
I have built a component library that includes an executive class which does work
I am using an API in a Java library which is called from the
I have a custom component called shopView which is an MXML skinnable component. I
I'm seeing some weirdness in event bubbling, which suggests I don't really understand how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.