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 6368815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:43:25+00:00 2026-05-25T00:43:25+00:00

I hava a custom component and it contains a child icon. If I add

  • 0

I hava a custom component and it contains a child icon. If I add a mouse-click event listener to both component(click-listener1) and icon(click-listener2), the event dispatched sequence is click-listener2, then click-listener1. I can understand it. But if I add a custom event to component (listener1), and mouse-click event to icon(listener2), when icon is clicked, the component will dispatch the custom event. In my test, the event dispatched sequence is listener1, then listener2. It doesn’t match with event-bubbles rule.

In my opinion The custom event is dispatched in listener2, which triggers listener1. Why event flow sequence is not listener2, listener1?

In component.

 icon.addEventListener(MouseEvent.CLICK, iconClickHandler);

    private function iconClickHandler(event:MouseEvent):void
    {
       trace ("Listener2");  
       var customEvent:CustomEvent= new CustomEvent(CustomEvent.CUSTOM_EVENT, true, true);
       dispatchEvent(customEvent)
       trace ("Listener3");  
    }

In Application, which contains component

 component.addEventListener(CustomEvent.CUSTOM_EVENT, customEventHandler);

private function customEventHandler(event:CustomEvent):void {
   trace ("Listener1");  
}
  • 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-05-25T00:43:26+00:00Added an answer on May 25, 2026 at 12:43 am

    UPD

    You’ve got:

    private function iconClickHandler(event:MouseEvent):void
    {
        trace("listener2");
        var customEvent:CustomEvent= new CustomEvent(CustomEvent.CUSTOM_EVENT, true, true);
        dispatchEvent(customEvent);
        trace("listener3");
    }
    
    
    private function customEventHandler(event:CustomEvent):void
    {
        trace("listener1");
    }
    

    When MouseEvent.MOUSE_CLICK is dispatched, it triggers first lucky listener – it is your component function iconClickHandler. Here we trace “listener2” and dispatch custom event.

    Due to syncronious nature of events, CUSTOM_EVENT listeners are triggered immediatly, that means that dispatching an event is similar to calling listener functions. Events are not stored anywhere, they are not delayed: listeners to events fires immediatly, in the same control flow, in the same thread.

    CUSTOM_EVENT was dispatched, its listeners were triggered – we’ve got a call to customEventHandler and “listener1” in console.

    When all the listeners were triggered, control returns to iconClickHandler and “listener3” is traced to console.

    That’s why we’ve got output:

    listener2
    listener1
    listener3
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i hava two text boxs in flex.have to add two txt boxs values in
I am struggling controlling my components. I hava a JFrame which contains a JPanel.
I hava set up AJAX script that when you click the button it calls
I hava a Bitmap variable named bmp in Activity1 , and I want to
I hava an activity which might have to load data when it's starting up.
I hava a class called DBhelper, and now I created a new class called
I hava a binary file like this : offset | size/type | Description -------+-----------+-----------------------------------------------------------
I hava a UITextView ,and after some characters' input, I want to use a
i hava made a select box of skills..there are skills listed in it.. if
i hava a c++ method(for java,jni) like follow,when i repeat call this from java

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.