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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:15:50+00:00 2026-05-25T00:15:50+00:00

public function doAddItem(itemConcepto:int):void{ modalCfd = new modalCFDItems(); modalCfd.addEventListener(Event.CLOSE, closeHandler); modalCfd.addEventListener(addItemResult, addItem_resultHandler); modalCfd.addEventListener(addItemResize, addItemResize_resultHandler); PopUpManager.addPopUp(modalCfd,

  • 0
public function doAddItem(itemConcepto:int):void{
                modalCfd = new modalCFDItems();
                modalCfd.addEventListener(Event.CLOSE, closeHandler);
                modalCfd.addEventListener("addItemResult", addItem_resultHandler);
                modalCfd.addEventListener("addItemResize", addItemResize_resultHandler);                
                PopUpManager.addPopUp(modalCfd, this, true)
                PopUpManager.centerPopUp(modalCfd);
            }
            private function addItem_resultHandler(event:Event):void{   
                addItemStuff();
                PopUpManager.removePopUp(modalCfd);
                removeListeners("modalCfd");
            }
            private function closeHandler(event:CloseEvent):void{
                PopUpManager.removePopUp(modalCfd);
                removeListeners("modalCfd");
            }
            public function removeListeners(listener:String):void{
                if(listener == "modalCfd"){
                    modalCfd.removeEventListener("addItemResult", addItem_resultHandler);
                    modalCfd.removeEventListener("addItemResize", addItemResize_resultHandler);
                    modalCfd.removeEventListener(Event.CLOSE , closeHandler);
                }
            }

As you can see I’m a newbie with good practices (in pretty much anything) How can I remove the event listeners correctly? That’s a Pop Up I’m handling there. Sorry if that function doesn’t make much sense, I simplified it to fit stackoverflow.

  • 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-25T00:15:50+00:00Added an answer on May 25, 2026 at 12:15 am

    You already have a reference to your object so just use that in your removelisteners function.

    public function doAddItem(itemConcepto:int):void{
                    modalCfd = new modalCFDItems();
                    modalCfd.addEventListener(Event.CLOSE, closeHandler);
                    modalCfd.addEventListener("addItemResult", addItem_resultHandler);
                    modalCfd.addEventListener("addItemResize", addItemResize_resultHandler);                
                    PopUpManager.addPopUp(modalCfd, this, true)
                    PopUpManager.centerPopUp(modalCfd);
                }
                private function addItem_resultHandler(event:Event):void{   
                    addItemStuff();
                    PopUpManager.removePopUp(modalCfd);
                    removeListeners();
                }
                private function closeHandler(event:CloseEvent):void{
                    PopUpManager.removePopUp(modalCfd);
                    removeListeners();
                }
                public function removeListeners():void{
                    modalCfd.removeEventListener("addItemResult", addItem_resultHandler);
                    modalCfd.removeEventListener("addItemResize", addItemResize_resultHandler);
                    modalCfd.removeEventListener(Event.CLOSE , closeHandler);
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public function doAddItem(itemConcepto:int):void{ modalCfd = new modalCFDItems(); modalCfd.addEventListener(Event.CLOSE, closeHandler); modalCfd.addEventListener(addItemResult, addItem_resultHandler); modalCfd.addEventListener(addItemResize, addItemResize_resultHandler); PopUpManager.addPopUp(modalCfd,
public function fileBrowse():void { var success:Boolean = fileRef.browse(); } public function initFileAndImageReferences():void { fileRef.addEventListener(Event.SELECT,
public function bmdToStr(bmd:BitmapData,width:int,height:int):String { var encoder:JPEGEncoder = new JPEGEncoder(); var encBytes:ByteArray = encoder.encode(bmd); return
Consider the following function: public function foo(bar1:int, bar2:uint, bar3:String, bar4:Boolean):void{} What I want is
I have this code public function TalentBox(x:int, y:int, arg_color:int = 0xFFFFFF):void { this.graphics.beginFill(arg_color); this.graphics.lineStyle(1.0,
public function create():ArrayCollection{ var index:int = 0; var data:ArrayCollection = new ArrayCollection(); var length:int
public class Greeter extends MovieClip { public function Greeter() { addEventListener(Event.ADDED_TO_STAGE, go); } private
I have a set function public function set energy(value:int):void when I try to call
public function configure() { $this->widgetSchema['start_date'] = new sfWidgetFormInput(); $this->widgetSchema['end_date'] = new sfWidgetFormInput(); $this->validatorSchema->setPostValidator( new
Public Function Cricket() As List(Of String) Dim list2 As New List(Of String)() With {

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.