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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:39:56+00:00 2026-06-13T05:39:56+00:00

Is there any benefit to removing the event parameter from event handlers if it’s

  • 0

Is there any benefit to removing the event parameter from event handlers if it’s not used? I have the following instance:

<s:Button rollOver="handleRollOver(event)" rollOut="handleRollOut(event)"/>

And the following code:

private function handleRollOver(event:Event):void
{
    // doing stuff
}

private function handleRollOut(event:Event):void
{
    // doing stuff
}

Is there any benefit to removing the event object if it’s not used? For example, changing it to this:

<s:Button rollOver="handleRollOver()" rollOut="handleRollOut()"/>

And the following code:

private function handleRollOver():void
{
    // doing stuff
}

private function handleRollOut():void
{
    // doing stuff
}

The reason I ask is for a couple of reasons. One is that I heard that events bubble through all the display objects so if you can stop them that saves some CPU (not sure how much). But that would involve calling event.stopProp() type of calls correct not merely and at capture time rather than bubble time? Also, I heard that typing the event helps save CPU, so event:Event is slower than event:MouseEvent. I can try and find sources but until then maybe someone knows what I’m talking about. Thanks

  • 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-13T05:39:57+00:00Added an answer on June 13, 2026 at 5:39 am

    I don’t believe there is any benefit, but there is no downside either. It works, nothing will error out. You just won’t have access to event properties. In the case of MXML, make sure you do not pass an event, otherwise you will get an error.

    Regardless, it is best practice to always pass events, regardless if you need to or not. It may be more convenient, but it makes your code less flexible and less recognizable when searching through it.

    If you are looking for a way to call the event handler without including an event, you can do this:

    private function clickHandler(e:MouseEvent = null):void{
    
    }
    

    Setting a default value of null for the event argument allows you bypass that requirement with zero issues. At this point, every single event handler I set up has a default value of null, sometimes with added arguments too, just so that I can call it manually if I need to.

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

Sidebar

Related Questions

Is there any benefit in salting passwords for a strong, unique (not used for
Is there any benefit (or conversely, cost) to passing a parameter by const value
Is there any benefit to performance when I do the following in Mootools (or
I found this construct in some code. Is there any benefit to have a
What's the reason for typedefs not being strongly typed? Is there any benefit I
A part from memory usage, is there any benefit using an Int32 on a
From what Ive seen. emacs etc.. run in terminal. Is there any benefit to
In asp.net is there any benefit to including or not including an id property?
Is there any benefit to include the length specifier in a format string for
I there any benefit to putting the javascript references in individual pages vs the

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.