Adding and removing listeners help please...

hi guys i have a pop up box that adds a listener depedent on a variable.
like such
     if(upload_typ != 'O' && upload_typ != 'E')
    {RPanel.DSUB.addEventListener(MouseEvent.CLICK, DatabaseSend)};
   if(upload_typ == 'O')
    {RPanel.DSUB.addEventListener(MouseEvent.CLICK, DataSendOntme)};
    if (upload_typ == 'E')
    {RPanel.DSUB.addEventListener(MouseEvent.CLICK, EncumSendVal)}
how do i remove the listeners? i continue to see examples of removing listeners but yet i dont see what the remove listener functions should do.
  any help would be greatly appreciated.
Miguel

In your case, because you can't be sure what listener was added, you can remove them all, and if they have not been added, no harm:
RPanel.DSUB.removeEventListener(MouseEvent.CLICK, DatabaseSend);
RPanel.DSUB.removeEventListener(MouseEvent.CLICK, DataSendOntme);
RPanel.DSUB.removeEventListener(MouseEvent.CLICK, EncumSendVal);
Alternatively, you could register the ones that actually get added to an object (associative array) and remove only those when necessary.
If this post answers your question or helps, please mark it as such. Thanks!
http://www.chikaradev.com
Adobe Flex Development and Support Services

Similar Messages

  • Best practice for adding and removing eventListeners?

    Hi,
    What is the best practice in regards to CPU usage and performance for dealing with eventListeners when adding and removing movieclips to the stage?
    1. Add the eventListeners when the mc is instantiated and leave them be until exiting the app
    or
    2. Add and remove the eventListeners as the mc is added or removed from the stage (via an addedToStage and removedFromStage listener method)
    I would appreciate any thoughts you could share with me. Thanks!
    JP

    Thanks neh and Applauz78.
    As I understand it, the main concern with removing listeners is to conserve memory. However, I've tested memory use and this is not really an issue for my app, so I'm more concerned if there will be any effect on CPU (app response) if I'm constantly adding and removing a list of listeners every time a user loads an mc to the stage, as compared to just leaving them active and "ready to go" when needed.
    Is there any way to measure CPU use for an AIR app on iOS?
    (It may help to know my app is small - I'm talking well under 100 active listeners total for all movieclips combined.)

  • All of my playlists made on my Ipod touch 3rd gen keep disappearing when I sync it to itunes. Drivng me crazy. All software up to date on both itunes and Ipod. Help please.

    All of my playlists made on my Ipod touch 3rd gen keep disappearing when I sync it to itunes. Drivng me crazy. All software up to date on both itunes and Ipod. Help please.
    I tend to make my playlists right on my ipod. This did not happen for the last 2 years. Just started recently. Did get a new computer recently.

    That is because you got a new computer. You can only sync all media from one syncing computer. You can sync from any computer to iPod using the manual method but that does not sync from iPod to computer.
    To make this your syncing computer:
    Syncing to a "New" Computer or replacing a "crashed" Hard Drive: Apple Support Communities

  • Adding and removing plug-in - Gets dirty Catalog?

    Trying many plug-in, adding and removing it, could be a problem with the file Catalog?
    The removed plug-in leaves traces on catalog? E.g.: a bites growed catalog....
    Thanks

    Rob,
    What about your ExifMeta plug-in?
    How it works with the catalog?
    Is there a catalog working difference between ExifMeta and DevMeta plug-in?
    Thanks

  • £37 has disappeared from my iTunes account. But no apps or music or tv/movies have been bought. Has it been hacked and can you help please?

    £37 has disappeared from my iTunes account. But no apps or music or tv/movies have been bought. Has it been hacked and can you help please?

    Report it to Apple:
    How to report an issue with your iTunes Store purchase - http://support.apple.com/kb/HT1933 - working through iTunes application and iTunes Store interface.
    iTunes Customer Service Contact - http://www.apple.com/support/itunes/contact.html
    Change the password on your account.

  • Dynamically adding and removing managed servers

    Hi,
              I'm experimenting with adding and removing managed servers while applications are running on the cluster. I've written some scripts using weblogic.Admin to do the tasks. It seems that it's working. However, I'd like to confirm that this is supported. I also have the following questions:
              1. Applications running on a cluster are automatically deployed to the newly configured managed server once it is started using startManagedWebLogic.sh. Are there any non-error situations that applications are not started automatically?
              2. To remove a managed server from the cluster, I first shutdown the server gracefully and then delete the server from the domain using weblogic.Admin. Is this the recommended way to do it?
              3. Anything else I need to pay attention to before adding and removing servers?
              Thanks for any information and pointers.
              Ming

    1. only if the staging mode is external.
              2. yes, if the server should be permanently removed. If the server is down for short maintenance, you do not need to remove it from the cluster.
              3. yes, try to avoid doing this during deployment tasks. That can be nasty.
              - Anders M.

  • HT1923 Hi, I have a iPod touch 4th generation and I does not show in iTunes. It comes up as charging when it is plugged into the computer but just not in iTunes. I have everything up to date and have restarted both computer and iPod. Help please?

    Hi, I have a iPod touch 4th generation. It comes up as charging when it is plugged into the computer but it does not show in iTunes. I have everything up to date and have restarted both computer and iPod. Help please?

    Try here  >   - http://support.apple.com/kb/TS1369.

  • Adding and removing tabs dynamically as in explorer

    adding and removing tabs dynamically as in explorer or firefox

    Think about how many translations are required to move your avatar, then think how many translations are required to move everything else in the entire world. Depending on whether there is more to translate in your avatar or in the rest of the world, you have your solution.
    Not knowing how your system works I can't really suggest anything further but could the collision avoidance be interacting with everything in the world as well? That would increase the workload somewhat.

  • My volume control is disabled after plugging in and unplugging headphones, Help Please...

    Dear all, this is my issue, I have since the beginning (October 2014) with my iPhone 5S, 64GB: My volume control is disabled after plugging in and unplugging headphones, Help Please...

    This should not happen if you have the output volume in System Prefs/Sound set low. Have you tried setting the ITunes player volume at top left a bit lower?

  • ADDING AND REMOVING CONTENTPANES

    PLEASE HELP ME OUT!
    I WROTE A PROGRAM TO DRAW SOME SHAPES LIKE RECTANGLE AND CIRCLE BY CLICKING ON TWO DIFFERENT BUTTONS FOR EACH SHAPE TO BE DRAWN. THE PROBLEM IS THAT, WHEN I CLICK ON ANY OF THE BUTTONS IT DRAWS THE SHAPE I CLICK BUT CANNOT REMOVE THE ALREADY DRAWN SHAPE WHEN I CLICK ON THE OTHER BUTTON. THAT IS, IF IT DRAWS RECTANGLE AND I CLICK ON BUTTON CIRCLE, IT CANNOT REMOVE RECTANGLE AND DRAW A CIRCLE.
    PLEASE I WILL LIKE ANY PERSON TO HELP ME OUT. SO THAT I CAN CLICK ON ANY OF THE BUTTONS AND IT WILL DRAW THE SHAPE I CLICKED ON.
    THANKS
    ALAM WINNER

    please help me out! i wrote a program to draw some shapes like rectangle and circle by clicking on two different buttons for each shape to be drawn. the problem is that, when i click on any of the buttons it draws the shape i click but cannot remove the already drawn shape when i click on the other button. that is, if it draws rectangle and i click on button circle, it cannot remove rectangle and draw a circle.please i will like any person to help me out. so that i can click on any of the buttons and it will draw the shape i clicked on.thanks alam winner
    Courtesy of "System.out.println( s.toLowerCase() );"

  • Adding and Removing an Instance in LiveCycle Designer 8.2

    Good Morning,
    I am just beginning to use LiveCycle Designer 8.2 which was packaged with Adobe Acrobat 9.0 and I was just given a short timelined project for a form to be created for which I would like to include a + and - button to add and remove instances (it would add and remove student information as needed .... maybe only a list of data involving 5 students or for other teachers they may have 10 students, etc.) so I want them to be able to add and remove "instances" as needed.  I have been working on this and looking at forums and clips and have not been able to successfully accomplish this task yet.  I am wondering if anyone can give me some help?  Thanks.
    L Gardner

    The best reference I've found is at
    http://forms.stefcameron.com/2006/11/11/instance-manager-object-reference/
    Let me know if you need a sample

  • No vídeo in my TV with original cable component and Ipad air, help please.

    How can I see my Ipad air and moviles in my TV with the original component cable, at the moment no works.
    Help please.

    Hey adbridge683,
    This is usually in reference to USB issues. This article has great step by step troubleshooting, so you can see the steps first hand yourself to try. http://support.apple.com/kb/ts3694#error50
    There's really only about 7 things to look for in there, and I hope that one of them helps you out!
    Let me know.
    -Regards

  • Browser cuts off half of table and contents? Help please.

    Hi,
    When viewing the page using some versions of IE7, the area
    where the Virtual tour viewer is and anything within the same table
    is cut in half ! I never even noticed it as I test on a laptop and
    desktop, both running IE7 and Firefox and there were no problems.
    Got 3 emails of totally different people asking where the other
    half of the page is, plus a friends browser does it also.
    The link is
    http://www.cicadastudio.ca/newyork.html
    The virtual tour viewer in the iframe, thumbnails and links
    are in the first big table. This gets cut in half approx after the
    text for each thumbnail so anything to the right is just white. No
    flash/quicktime logos and only half the viewer shows. It still
    works though loading the default panorama!
    The big table below holding regular still images with the
    black background displays correctly. Very strange.
    Does any one else only see half the table or know what may be
    causing it to happen? The most obvious thing would be the iframe
    but this has happed with some of the other pages also and they have
    no iframes on them.
    Thanks
    Andrew

     I see and It only prints half the photo? Interesting...
    What i would suggest doing is this,
    - go to the page/photo on face book where you are trying to print/save from
    - right click on the Photo and ""Save As"", now i would recommend saving them in the " My Pictures" from within the "My Documents" folder
    -Once saved, go ahead and open them up (Pictures)  from within the Folder and not the website, unfortunately, it sounds like the web site is not allowing the full command/picture to be sent through, but being a 3rd party Site We cannot be sure..
    -that is what i would advised to get those to Print Fully and to your Expectations
    __ if this Solution has helped Please Mark as resolved and A Kudos Would be Appriciated__
    even though i am a Employee of HP my Views and Opinions are my own...
    I am an HP employee.
    __ if this Solution has helped Please Mark as Resolved and feel free to Provide a Kudos__

  • Adding and removing children with buttons

    So I've been following this tutorial (http://www.danfergusdesign.com/classfiles/oldClasses/VCB331-richMedia1/exercises/addingChi ldren.php) on how to add and remove children with buttons in order to create a popup box on the stage.
    The part I'm having trouble with is how I add the close button to the stage on top of the popup box.
    This is basically what I'm trying to do:
    Here's my code right now:
    var OrderPrepOnlineMenuInstance:OrderPrepOnlineMenu = new OrderPrepOnlineMenu();
    var mcOnStage:Boolean=false;
    loadOrderPrepOnlineBtn.addEventListener(MouseEvent.CLICK, loadMC);
    OrderPrepOnlineClose.addEventListener(MouseEvent.CLICK, removeMC);
    function loadMC(MouseEvent):void {
    addChild(OrderPrepOnlineMenuInstance);
    OrderPrepOnlineMenuInstance.x = 465;
    OrderPrepOnlineMenuInstance.y =230;
    mcOnStage=true;
    function removeMC(MouseEvent):void {
    if (mcOnStage ) {
    removeChild(OrderPrepOnlineMenuInstance);
    mcOnStage=false;

    Why not just make the close button part of the object you are adding.  You can assign it an event listener thru that object after it is created.

  • I keep losing my connection from iMac to keyboard and mouse any help please

    I keep losing connection between imac and my mouse and key board.I then have to power off and reboot to get connection can anyone help please!!!!

    Hi
    Update date for anyone who ha suffered with the problem of losing connection to an ext HDD.
    For me, the solution appears to have been achieved by making use of my old 802.11 b&g Airport Extreme base station and my new 802.11 n Airport Extreme Base Station.
    My network is now setup as follows:-
    Airport 802.11 n - 5GHz
    Macbook Black
    Apple TV
    Time Capsule
    Airport Express Base Station
    Airport 802.11 b&g - 2.4GHz
    Playstation 3
    Xbox 360 Elite
    Nintendo Wii
    iPhones
    iPod Touch
    Canon Wi-fi Printer
    iMac G5
    Sony VAIO TX2P
    I connect my ADSL line to both AEBS by ethernet, changed the settings and this has dramatically improved my connection reliability and speed when streaming movies and/or music.
    Through trial & error, I have also discovered that the other problems that I have are connected to situations when restart my Macbook after a shut down or restart and my iPhone is connected. This causes iTunes to start up but due to the restart, the ext HDD is not ready and therefore, ITunes opens its local library - I now just try to remember to use the Option key to choose the library. Finally, if the laptop just runs out of juice, the ext HDD doesn't have the chance to have a friendly handshake before losing its connection. When I restart, the connection does to the HDD fails and I have to restart AEBS
    I hope that helps anyone with similar problems or who wants to make the most of their fast 802.11n equipment by making is use of that kit that was maybe considered redundant - by creating a dual frequency network that maximizes speeds on 802.11 n whilst allowing use of the legacy 802.11 b&g devices.

Maybe you are looking for