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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:42:57+00:00 2026-05-16T04:42:57+00:00

I have created a custom event in flex 3.5. But the handler is not

  • 0

I have created a custom event in flex 3.5. But the handler is not invoked. How to solve this or what is the way to debug this problem?

The Event class:

package com.saneef.worldlanguages.events
{
    import flash.events.Event;

    public class LanguageEvent extends Event
    {
        public static const LANGUAGE_SELECTED:String = "LanguageSelected";

        public function LanguageEvent(type:String,languageid:String)
        {
            super(type);
            this.langid = languageid;
            trace("LanguageEvent: " + this.langid);
        }

        public var langid:String;

        override public function clone():Event {
            return new LanguageEvent(type, langid);
        }
    }
}

Dispatching:

private function functionOne():void
{       
    try{
        dispatchEvent(new LanguageEvent(LanguageEvent.LANGUAGE_SELECTED,"STR"));
    }
    catch(e:Error)
    {
        trace(e.message);
    }
}

In the Main application class, EventListener:

protected function application1_initializeHandler(event:FlexEvent):void
{
  this.addEventListener(LanguageEvent.LANGUAGE_SELECTED,
 application1_LanguageSelectionHandler);
}

The event handler function:

public function application1_LanguageSelectionHandler(event:LanguageEvent):void
{
    trace("application1_LanguageSelectionHandler: " + event.langid);
    populate_countrya3id_languages(event.langid);
}
  • 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-16T04:42:58+00:00Added an answer on May 16, 2026 at 4:42 am

    Your code looks fine. Since I can’t see the full source, here are my two thoughts on what may be going on:

    1. Are you sure your addEventListener call is done before you dispatch the event? Add some trace to make sure the application1_initializeHandler prints before functionOne does.

    2. Is your functionOne call in another different component than your main application? If so, you’ll need to set your custom event’s bubbles attribute to true in your event’s super call.

       public function LanguageEvent(type:String,languageid:String,bubbles:Boolean=True)
       {
          super(type, bubbles);
          this.langid = languageid;
          trace("LanguageEvent: " + this.langid);
       }
      

    See the flash.events.Event docs for the constructor call. Also, here’s a quote about the bubbles argument explained here:

    The bubbles property

    An event is said to bubble if its
    event object participates in the
    bubbling phase of the event flow,
    which means that the event object is
    passed from the target node back
    through its ancestors until it reaches
    the Stage. The Event.bubbles property
    stores a Boolean value that indicates
    whether the event object participates
    in the bubbling phase. Because all
    events that bubble also participate in
    the capture and target phases, any
    event that bubbles participates in all
    three of the event flow phases. If the
    value is true, the event object
    participates in all three phases. If
    the value is false, the event object
    does not participate in the bubbling
    phase.

    Based on your source code, it looks like you’ve seen the “Dispatching Custom Events” in the flex docs, but I’ll link to it anyways for future/easy reference: http://livedocs.adobe.com/flex/3/html/help.html?content=createevents_3.html.

    Also, check out http://www.adnandoric.com/2008/12/29/understanding-the-flex-event-propagation/ for a high-level overview of the event propagation system to try to get a better understanding of what’s going on while developing.

    Edit:

    Based on your comments I’m guessing your functionOne call is in a separate class and your “main” application has an instance of this class. If that’s so you’ll want to attach your event listener on that instance and delegate it to your main’s application1_LanguageSelectionHandler function… Like so:

    protected function application1_initializeHandler(event:FlexEvent):void
    {
      this.theInstanceThatHoldsYourFunctionOne.addEventListener(LanguageEvent.LANGUAGE_SELECTED,
     application1_LanguageSelectionHandler);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why event needs to have at least one handler? I created custom event for
I have created a custom even class which is pretty basic. But when calling
I have created a custom event in my Qt application by subclassing QEvent. class
This way i have created my custom button and set the image.I have set
I have created a custom control but I can't bind a property to the
I have created a custom control inheriting TextBox . This custom control is a
I have created a custom list view and created my own adapter class I
I have created a custom UIButton (UIButton subclass) for my application. Within this button's
I have created a custom event to handle how the data should be updated
It's not the first time I've created a Custom Event in C#. It boggles

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.