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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:06:06+00:00 2026-05-17T17:06:06+00:00

I have got a custom event set up (see below), but when I listen

  • 0

I have got a custom event set up (see below), but when I listen for the event in my main class, and it gets dispatched from the child class, it never gets captured.

TRIED:

this.b.addEventHandler(GameLaunchEvent.GAME_LAUNCH_EVENT, this.eventHandler)


package com.thom.events 
{
    import flash.display.MovieClip;
    import flash.events.Event;

    /**
     * ...
     * @author 
     */
    public class LaunchEventAbstract extends Event
    {
        public var parent:MovieClip;
        public function LaunchEventAbstract(type:String, parent:MovieClip = null) 
        {
            super(type, true);  
            this.parent = parent;
        }   
    }
}

package com.thom.events 
{
    import flash.display.MovieClip;
    import flash.events.Event;

    /**
     * ...
     * @author
     */
    public class GameLaunchEvent extends LaunchEventAbstract 
    {
        public static const GAME_LAUNCH_EVENT:String = "GameLaunchEvent";
        public function GameLaunchEvent(parent:MovieClip = null) {
            trace("GameLaunchEvent");
            super(GAME_LAUNCH_EVENT, parent);
        }
    }

}

//example code
package {
   import com.thom.events.*;
   public class A extends MovieClip{
         public var b:B;
         public function A(){
              addEventListener(GameLaunchEvent.GAME_LAUNCH_EVENT, eventHandler);
              this.b = new B();
              addChild(b);
         }
         public function eventHandler(e:GameLaunchEvent){
             trace("Success");
         }
    }
}
package {
    import com.thom.events.*;
    public class B extends MovieClip{
         public function B() {
              dispatchEvent(new GameLaunchEvent(this));
         }
     }
}
  • 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-17T17:06:06+00:00Added an answer on May 17, 2026 at 5:06 pm

    You don’t really need to pass the parent as a parameter , particularly if you intend to listen to your event in the parent itself. What you can do is pass a dispatcher as a parameter and let the dispatcher both dispatch & listen to the event.

    
    package 
    {
       import flash.display.MovieClip;
       import flash.events.Event;
       import flash.events.EventDispatcher;
    
       public class A extends MovieClip
       {
             public var b:B;
             private var _dispatcher:EventDispatcher = new EventDispatcher();
    
             public function A()
             {
             _dispatcher.addEventListener('test', eventHandler);   
                 this.b = new B(_dispatcher);
             }
    
             public function eventHandler(e:Event):void
             {
                 trace("Success");
             }
        }
    }
    
    
    package 
    {
        import flash.display.MovieClip;
        import flash.events.Event;
        import flash.events.EventDispatcher;
    
        public class B extends MovieClip
        {
            private var _dispatcher:EventDispatcher;
    
            public function B(dispatcher:EventDispatcher) 
            {
                this._dispatcher = dispatcher;
                _dispatcher.dispatchEvent(new Event('test'));
            }
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have custom headers in the Silverlight DataGrid using the ContentTemplate. We've got a
i have got <div><a class='link' href='index.php' data-container='target'>Load</a></div> <div class='target'></div> i need to write jquery
I have got two pages. example.com/php.com and example.com. I use this function to set
I have a custom behavior inside a DataTemplate, which raises a custom Routed Event.
I just got a custom handler set up to redirect with a 301 response
Can someone give me an example of creating a custom set of an Event
I've got a fairly standard Spring webapp, and I have a number of custom
Have got an NSString *str = @12345.6789 and want to find out if there
I have got the requirement to find the core file in multiple box/machine and
I have got this code: function init(){ if (typeof window.jQuery !== 'function') { var

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.