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

  • Home
  • SEARCH
  • 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 8339537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:54:35+00:00 2026-06-09T04:54:35+00:00

I moved my code from my Application to a separate AS class file and

  • 0

I moved my code from my Application to a separate AS class file and now I’m getting the following errors:

1061: Call to a possibly undefined method addEventListener through a reference with static type Class.

1180: Call to a possibly undefined method addEventListener.

.

package managers {


    import flash.events.Event;
    import flash.events.EventDispatcher;

    public class RemoteManager extends EventDispatcher {


        public function RemoteManager() {

        }


        public static function init(clearCache:Boolean = false):void {

            addEventListener(SETTINGS_CHANGE, settingChangeHandler);
            addEventListener(ITEMS_UPDATED, itemsUpdatedHandler);
        }
    }
}
  • 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-09T04:54:36+00:00Added an answer on June 9, 2026 at 4:54 am

    Your code

    addEventListener(SETTINGS_CHANGE, settingChangeHandler);
    

    evaluates to

    this.addEventListener(SETTINGS_CHANGE, settingChangeHandler);
    

    There is no this in a static method, since it’s designed to function without an instance. Furthermore, you cannot attach an event listener and dispatch events from a static class.

    Either change your function declaration to

    public function init(clearCache:Boolean = false):void
    

    Or implement a singleton pattern to kinda get a “static class, that dispatches events”.

    Singleton with event management.

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

Sidebar

Related Questions

I've recently moved my project from sourceforge to Google code. I'm intrigued by the
This was working..and I moved the disposal code to the finally block, and now
I have the following code: void doPlayerMove(void) { bool moved = false; while (!moved)
In rails 3 the application.js file was moved to assets>javascripts>application.js In this file there
I am developing a parser application to build a call tree from DDL files
My web application parses data from an uploaded file and inserts it into a
I'm writing a console application that reads in from a csv file and stores
Having been given the all clear to move code from my Page_Loaded method to
In my project I'm currently preparing a step-by-step move from legacy code to new,
Okay so, I'm currently running this code to move a bunch of data from

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.