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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:11:44+00:00 2026-06-03T11:11:44+00:00

If I have a button on the timeline for the first few frames, but

  • 0

If I have a button on the timeline for the first few frames, but then I remove it…

Do I have to worry about removing the event listener for the button (MovieClip) if the button has be removed from the stage?

I’m writing a Document Class even though I’m using objects on the timeline.

  • 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-03T11:11:49+00:00Added an answer on June 3, 2026 at 11:11 am

    You could use the removedFromStage event to clear up any event listeners on your button instance:

    package 
    {
        import flash.display.MovieClip;
        import flash.events.Event;
        import flash.events.MouseEvent;
    
        public class Button extends MovieClip
        {
            public function Button():void
            {
                addListeners();
            }
    
            private function addListeners():void
            {
                this.addEventListener(Event.ADDED_TO_STAGE, addedHandler);
                this.addEventListener(Event.REMOVED_FROM_STAGE, removedHandler);
                this.addEventListener(MouseEvent.CLICK, clickHandler);
            }
    
            private function addedHandler(event:Event):void
            {
                trace("button added");
            }
    
            private function removedHandler(event:Event):void
            {
                trace("button removed");
                removeListeners();
            }
    
            private function clickHandler(event:MouseEvent):void
            {
                trace("button clicked");
            }
    
            private function removeListeners():void
            {
                this.removeEventListener(Event.ADDED_TO_STAGE, addedHandler);
                this.removeEventListener(Event.REMOVED_FROM_STAGE, removedHandler);
                this.removeEventListener(MouseEvent.CLICK, clickHandler);
    
                trace("has added listener: " + this.hasEventListener(Event.ADDED_TO_STAGE)); 
                trace("has removed listener: " + this.hasEventListener(Event.REMOVED_FROM_STAGE));
                trace("has click listener: " + this.hasEventListener(MouseEvent.CLICK));
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have button, which fires an event, that deletes a record from the database.
I have got two movieclips on the main timeline. First one is envelope_mc and
I have created Read button for publishing actoin on facebook timeline using opengraph! So
I have button event. If single tap(touch) on button i am doing Flip action
I have button at first column in datagrid. I am using MVVM and try
I have an object (button) on frame 2 of my timeline, with the name
I have an 'Add To Timeline' button and I can already add posts to
I have one issue with Datetime Picker In my firstview i have button.If i
I have one issue with UInavigationcontroller In my firstview i have button.If i click
I have a button that when clicked will run a stored procedure on 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.