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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:57:11+00:00 2026-06-05T20:57:11+00:00

What is the difference between a listener and handler? I have searched a lot,

  • 0

What is the difference between a listener and handler?

I have searched a lot, but I couldn’t find a suitable explanation. Where do I use a listener and where do I use a handler in Android?

I have gone through the following link as well:

Are event handler, event listener, and event registration all referring to the same thing?

Where can I get a comparative discussion of these two items? Also, can anyone tell me what are the different kinds of listener and handler available?

  • 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-05T20:57:12+00:00Added an answer on June 5, 2026 at 8:57 pm

    A number of ActionScript classes feature something called events. An event is raised by an object when a certain occurrence happens. For example, when someone hovers over a button symbol in a SWF, the Button.onRollOver event is raised for that particular Button instance. When the mouse is moved elsewhere, the Button.onRollOut event is raised for that same instance. These events take place whether or not anyone takes notice. If you want to actually do something in response to an event, you must manage it with an event handler or an event listener. The choice between these two is determined by the object — some objects expect handlers, some listeners — so hit the ol’ ActionScript Language Reference when in doubt. Handlers are relatively easy, but for some reason, listeners seem to perplex people at first.

    Event Handlers

    The most popular events probably belong to the Button and MovieClip classes, which happen to share many of the same (a movie clip can be a button, but not the other way around). To handle the Button.onRelease event, all you have to do is drag a button symbol to the Stage and give it an instance name via the Properties inspector. Use this name in a frame script to assign a function to the event.

    myButton.onRelease = function() {
      // do something
    }
    

    The other Button events work the same way, as do the MovieClip events and all events that require event handlers.

    Any number of events can be handled. Just assign a function to each event, as necessary. A button that responds to a roll over, release, and roll out, for example, might look like this …

    myButton.onRollOver = function() {
      // do something
    }
    myButton.onRelease = function() {
      // do something
    }
    myButton.onRollOut = function() {
      // do something
    }
    

    Event Listeners

    Managing event listeners requires a few more steps. A listener is accomplished with a generic Object instance. This object acts as a liaison between at least two others: the object that raises the event, and any objects listening for the event. Let’s look at a MovieClipLoader example.

    var mcl:MovieClipLoader = new MovieClipLoader();
    

    At this point, we’ve declared a variable, mcl, that points to an instance of MovieClipLoader. Now we’ll declare another variable, mclListener, that points to an instance of Object. (Sounds funny, I know, but we’re creating an Object object.)

    var mclListener:Object = new Object();
    

    This generic object will now become our liaison. At this point, the code looks very similar to the event handler approach.

    mclListener.onLoadInit = function() {
      // do something
    }
    

    I could have picked any event from the MovieClipLoader class, it really doesn’t matter. The thing to notice here is that a generic object is handling the event on behalf of the operative class instance. With event handlers, the operative class instance handles its own events.

    Now that we have our listener, and now that a function has been assigned to one of its events on behalf of our MovieClipLoader instance, we simply need to subscribe the listener to mcl.

    mcl.addListener(mclListener);
    

    Done. Let’s see that all in one take:

    var mcl:MovieClipLoader = new MovieClipLoader();
    var mclListener:Object = new Object();
    mclListener.onLoadInit = function() {
      // do something
    }
    mcl.addListener(mclListener);
    

    To listen for more than one event, just follow suit with the event handler approach.

    var mcl:MovieClipLoader = new MovieClipLoader();
    var mclListener:Object = new Object();
    mclListener.onLoadStart = function() {
      // do something
    }
    mclListener.onLoadProgress = function() {
      // do something
    }
    mclListener.onLoadInit = function() {
      // do something
    }
    mcl.addListener(mclListener);
    

    Ref: http://www.quip.net/blog/2006/flash/event-handlers-listeners

    You may also check this yahoo answer

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

Sidebar

Related Questions

What's the difference between an event handler and an event listener? Up until recently
What is the difference between TCP listener and TCP server? I want to communicate
Difference between list & arraylist in android. How can i sort out arraylist?
//Difference between 2 dates This function works well but display wrong time format. Pls
What is the difference between adding a listener and setting a listener. e.g. addTextChangedListener(textWatcher);
Difference between start-pointers and interior-pointers and in what situation we should prefer one over
The difference between Chr and Char when used in converting types is that one
JAVA : is there a difference between the two references p && pp? PrintStream
What are the difference between a public class member class data { public: std::list<data>
Can any one explain difference between position and anchor point in cocos-2D with some

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.