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

The Archive Base Latest Questions

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

Simple question..I was wondering when you guys extends EventDispatcher in your class. It seems

  • 0

Simple question..I was wondering when you guys extends EventDispatcher in your class. It seems to me that as long as we have import event package, we can dispatchEvent without problems….I saw sometime people extends EventDispatcher in their class…not sure why…anyone care to explain? Thanks a million…

  • 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:46:54+00:00Added an answer on May 16, 2026 at 4:46 am

    I think you might be confusing the fact that many objects in AS3 extend EventDispatcher higher in the inheritance tree with only needing to import the flash.events package in order to dispatch events. For instance many DisplayObject classes extend the EventDispatcher. Here are a couple of examples:

    Shape » DisplayObject » EventDispatcher » Object
    
    Sprite » DisplayObjectContainer » InteractiveObject » DisplayObject » EventDispatcher » Object
    

    Typically I will extend EventDispatcher any time I am working with a custom class that just needs to communicate to objects outside of it’s scope that some internal property has changed or that some function is occuring. Here is an example:

    public class Clock extends EventDispatcher
    {
         protected var _tick:uint;
    
         protected function run():void
         {
             if( _tick + 1 > 60 ) {
                 _tick = 0;
             } else {
                 _tick++;
             }
             dispatchEvent( new Event( Event.CHANGE ) );
         }
    
         public function getTick():uint { return _tick; }
    }
    

    Sometimes it is “important” to keep the internal details of an object read only. In the case of the above example, when the run() method is called, the Clock class performs some internal logic and then dispatches an event indicating that something has changed. Any class that is listening for that event can then call the public getTick() method to find out the value of _tick. This hides the implementation and protects the _tick variable from being changed by outside classes and at the same time provides an interface through which the Clock can be read.

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

Sidebar

Related Questions

Simple question: Is there a class or interface that encapulates the getting of a
I have a simple question, but I can't find out the answer. I'm wondering
This is probably a simple question, I have a form that you put in
I was wondering if someone could help me with a simple question? i have
Pretty simple question, I have a webpage that is used exclusively on iPads. I've
I have a very simple question. I have an SQL query that looks like
this may be a simple question but i was wondering, i have an application
Simple question here... I was wondering if it's possible to access class propertys by
I have a pretty simple question, but with an answer that I am unable
Simple question. Just wondering if this can be done without me having to enforce

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.