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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:11:16+00:00 2026-06-15T23:11:16+00:00

I have class EventManager with method: public function addEvent(obj:IEventDispatcher, event:String, listener:Function, useCapture:Boolean = false,

  • 0

I have class EventManager with method:

public function addEvent(obj:IEventDispatcher, event:String, listener:Function, 
       useCapture:Boolean = false, priority:int = 0, 
       useWeakReference:Boolean = false):void 
{           
   obj.addEventListener(event, listener, useCapture, priority, useWeakReference);
   [here event is pushed in my stack]    
}

I want to do this:

public class CustomClass extends Sprite
{    
    public override function addEventListener(type:String, listener:Function, 
           useCapture:Boolean = false, priority:int = 0, 
           useWeakReference:Boolean = false):void
    {
        eventManager.addEvent(this, type, listener, useCapture, priority, useWeakReference);            
    }    
}

but in a result call stack is:

   customClass.addEventListener ->

   eventManager.addEvent ->

   customClass.addEventListener ->

   eventManager.addEvent ->

   customClass.addEventListener ->

   ...

and so on… because I invoke obj.addEventListener in eventManager.addEvent

Maybe can you give me a solution of this problem?

  • 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-15T23:11:17+00:00Added an answer on June 15, 2026 at 11:11 pm

    You created a recursive loop since you in event manager calls the addEventlistener function on object which calls the event manager etc… What you probably meant to do was to only store a reference to the object and the parameters inside event manager and not actually calling the addEventlistener-function from there.

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

Sidebar

Related Questions

I have class with back reference: public class Employee : Entity { private string
I have class like this: public class object { [Key] int number; String mystring;
I have declared an event in my UserControl class Main: public static readonly RoutedEvent
I have class with collection as below public class MyClass:IXmlSerializable { int vesrion; private
We have class lua. In lua class there is a method registerFunc() which is
I have class that looks like this: class A { public: class variables_map vm
I have class with main method just to print Hello World when trying to
I have class for iterating images. public class PictureManager { private int _current; public
I have class BaseClass that contains a few methods like public Result mothodA(Token token,
I have: class A {...}; class B : public A {...}; class C :

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.