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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:13:28+00:00 2026-05-12T16:13:28+00:00

Is there a better way to set up a flash project with lots of

  • 0

Is there a better way to set up a flash project with lots of navigation than having to do this?:

bottomNav.contact_btn.addEventListener(MouseEvent.CLICK, changeContent);
bottomNav.portfolio_btn.addEventListener(MouseEvent.CLICK, changeContent);
bottomNav.news_btn.addEventListener(MouseEvent.CLICK, changeContent);
bottomNav.inspiration_btn.addEventListener(MouseEvent.CLICK, changeContent);
bottomNav.home_btn.addEventListener(MouseEvent.CLICK, changeContent);


secondaryNav.about_btn.addEventListener(MouseEvent.CLICK, changeContent);
secondaryNav.services_btn.addEventListener(MouseEvent.CLICK, changeContent);
secondaryNav.home_btn.addEventListener(MouseEvent.CLICK, changeContent);

secondaryNav.inspiration_btn.addEventListener(MouseEvent.CLICK, changeContent);
secondaryNav.inspiration_archive_btn.addEventListener(MouseEvent.CLICK, changeContent);
secondaryNav.portfolio_showcase_btn.addEventListener(MouseEvent.CLICK, changeContent);
secondaryNav.portfolio_archive_btn.addEventListener(MouseEvent.CLICK, changeContent);

and if not, there are always moments between animations where the last thing you want to happen is for someone to click a button and have another function fire off in the middle of your beautiful wipe between two scenes. You end up with (or at least I do) countless errors and a pissed off client.

What do you do to suspend all of those listeners without adding a function to the end of every other function to temporarily disable them?

Please, if someone has the magic practice, I’d love to hear it.

in regards to how I do it I’ve been writing something like this:

function suspendBtns():void
{
secondaryNav.inspiration_archive_btn.removeEventListener(MouseEvent.CLICK, changeContent);
secondaryNav.portfolio_showcase_btn.removeEventListener(MouseEvent.CLICK, changeContent);
secondaryNav.portfolio_archive_btn.removeEventListener(MouseEvent.CLICK, changeContent);

}

and would add suspendBtns(); to the end of every function that would transition between clips.
then obviously another function called enactBtns() or something like that.

I tried once just adding one event listener to the stage:

stage.addEventListner(MouseEvent.CLICK, doFunction);

and then the function would find the name of the btn like:

function doFunction(e:Event):void{

 switch(e.target.name){     
    case"home_btn":
    doThis();
    break;

    case"away_btn":
    doThat();
    break;

  }

}

and so on. That didn’t work so well, it felt as though I had to click every button twice to get it to work.

And I still had to suspend the event listener in between actions.

  • 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-12T16:13:28+00:00Added an answer on May 12, 2026 at 4:13 pm

    An alternative to removing listeners, to temporally disable buttons, like in the suspendBtns example function above, is to set mouseEnabled to false.

    so instead of:

    function suspendBtns():void
    {
    secondaryNav.inspiration_archive_btn.removeEventListener(MouseEvent.CLICK, changeContent);
    secondaryNav.portfolio_showcase_btn.removeEventListener(MouseEvent.CLICK, changeContent);
    secondaryNav.portfolio_archive_btn.removeEventListener(MouseEvent.CLICK, changeContent);
    }
    

    … you would have:

    function suspendBtns():void
    {
    secondaryNav.inspiration_archive_btn.mouseEnabled = false;
    secondaryNav.portfolio_showcase_btn.mouseEnabled = false;
    secondaryNav.portfolio_archive_btn.mouseEnabled = false;
    }
    

    That way, the suspendBtns function won’t need to know what listeners to remove, and correspondingly to be added again when the buttons are to be enabled again. It will also disable other MouseEvent’s, like MOUSE_OVER and so on.

    And I’d also recommend storing the buttons in an array, as suggested by Allan and Tahir.

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

Sidebar

Related Questions

Is there a better way of appending a set to another set than iterating
Is there better way to enumerate all photos on the device than this one?
Is there a better way than this to splice an array into another array
Perhaps there's a better way to set this up so I'm open to suggestions.
Is there a better way than using globals to get interesting values from a
Is there a better way than examine them pixel by pixel?
Is there a better way to do this jquery code? Currently I have to
Is there a better way to structure this, using html and php? If I
There may be a better way to do this, and please direct me if
Is there better way to delete a parameter from a query string in a

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.