advisable to remove and reassign the listeners to button

Hello

I'm trying to delete and then reassign a MouseEvent.CLICK to a step on the button, using the step button for 1 second.

When the first button is released, it works very well, but what 2nd is published, 1 a MouseEvent should be cleared and be given a second listenner.

what I'm missing here?

code example

bt_ok.addEventListener (MouseEvent.CLICK, log_in);

bt_pesquisa.addEventListener (MouseEvent.CLICK, pesquisar);

//

function log_in(e:MouseEvent) {}

var BTN = getChildByName ("bt_pesquisa");

{if (BTN.hasEventListener (MouseEvent.Click))}

trace ("exist um listener activo");

If (btn.removeEventListener (MouseEvent.CLICK, pesquisar)) {}

trace ("1 remocao");

btn.addEventListener (MouseEvent.CLICK, pesquisar_2)

} else {}

trace ("not removed");

}

}

}

Thanks for help

Pluda

removeEventListener returns an empty and not a Boolean... so you can not do the if(!...) "check.

If you need to perform a sanity check, then you can removeEventListener first and check if it exists before adding the new event.

Right now, we just have to trust that the current callback method is deleted by the runtime Flash

This code works...

function log_in(e:MouseEvent) {}

var btn = getChildByName ("bt_pesquisa");

btn.removeEventListener (MouseEvent.CLICK, pesquisar)

If (! btn.hasEventListener (MouseEvent.CLICK))

{

trace ("add a new event listener");

btn.addEventListener (MouseEvent.CLICK, pesquisar_2);

}

on the other

{

trace ("remove current event has failed");

}

}

Tags: Adobe Animate

Similar Questions

  • Want desolde/resolder, remove and replace the two damaged usb2 ports

    I have a Sat A30 perfect by all means other than 2 USB2 ports on the back that are damaged (black plastic seperaters between connectors jumped) not quite sure why this happened because I was simply unplug the connected usb plugs on both occasions.

    The connectors were not especially tight. fault is I have no insulation between copper connectors which are still found in the slots and causes a short circuit, when I plug in a usb device.

    I bought a card mother relpacement (damaged) and usb2 connections are OK! Have good technician experience in carring out Soldering/desoldering and has all the tools. Problem is that I have not the slightest idea what connections under the Board of Directors are required to unsolder my damaged usb2 card in order to remove/swop and perform the necessary replacement.

    I'm sure I'll be advised to contact an authorized reseller of Tosh. I tried this and they say that they will be already only the motherboard together and the cost is horrible. I would rather make the repair myself that's not rocket science.

    The techies out there who could counsel with picture of the relevent pins to desoldering in order to remove and repair the fault would be greatly appreciated.

    E-mail: [email protected]

    If you can help in any way or point me in the right direction to go repair.

    I hope someone can help. Thank you very much
    Stewart

    Hello

    Please don't be crazy about me, but in my opinion, is not a very good idea to open the notebook alone if you don't have a lot of experience with it. Laptops are designed on the specific way and exchange of material is not so easy as the exchange of material to work stations.

    Believe me that a small error in the assembly/disassembly procedure can case damage to equipment or the façade of the same laptop parts. I know that there's not much service partner assistance because they want to do. It costs money, but you must understand that if they give that kind of advice or information they may close the shop very soon.

    You can try to do it alone, but at your own risk and be careful.

  • SE error message: remove and check the color cartrides in HP officejet v40

    Original title: officejet v40

    Can not connect my HP officejet v40. The printer says remove and check the color cartrides I did with no resilts. Please advise me how to do nest?

    Can not connect my HP officejet v40. The printer says remove and check the color cartrides I did with no resilts. Please advise me how to do nest?

    Hey pc owners

    Contact support to the installation of their products Hewlett Packard

    Walter, the time zone traveller

  • Removing and installing the RAM several times can affect to my Mac Mini?

    My little brother back RAM on my Mac Mini many times; but it remove the RAM properly and install it correctly

    Removing and installing the RAM may affect to my Mac Mini?

    Mac Mini (late 2012)

    OS X 10.11.5

    No, it should not affect the machine when the withdrawal/re-installing memory - correctly.

    My second thought about this - why it has removed/re-installed memory several times?  Trying to upgrade the drive?  change a component any?  repair?

    Materials only I 'played' were - SSD, adding second HARD drive disk with data doubling cable, insulating modular wifi/bluetooth, etc. and of course, the upgrade memory.  Once they did that, I got very little intention of reopening the mini - except air jet, clean the fan.

    Sam

  • What is the problem with my iphone? He says still no service but my sim card works with other phones, after a reboot it says searching until I have to remove and reinsert the sim ive done all what is the factory reset to open the phone to verify any damag

    IPhone 6 64 gb

    iOS 9.2.1

    The phone says no service but the SIM card works, everything in the phone works except the flash still lights up and flickers sometimes before becoming stable but who don't mind not 'that' much, ive tried factory reset and everything, ive also open the unit and looked for signs of damage, the phone knows there is a SIM card in the phone , but he never says the name of the carrier, also after the restart he said looking and does not stop until I have remove and reinsert the SIM card.

    You can restore the factory state after an iTunes backup

    If this does not resolve the problem then you may want to align on Apple or an approved repair shop

  • Satellite A30 921: how to remove and replace the memory?

    Hi, can someone help me how to remove and replace the memory of satellite A30 921. and also, please give a detailed instruction.

    Thank you in advance.

    Hello

    There is not much to explain. On the low side in the Middle it is placed to cover memory (fixed with two screws). Remove the cover and you will see 2 slots there. I put t know how much memory you here but like Stefan says you can use max 2 GB of RAM (2 x 1024Mo PC2700 - PA3313U-1M1G). How to remove the memory modules, which you can see on http://www.hardwaresecrets.com/article/189/5

    Good bye

  • Laptop HP Touchsmart 15-D020: how to remove and replace the keyboard on laptop HP Touchsmart 15-D020NR

    I spilt a drink on my keyboard and now I can not turn off the caps lock and a number of keys does not work. I need instructions on how to remove and replace the keyboard frame. Thank you.

    On your page of support-look for Maintenance and Service of Guide in the manuals.

    http://support.HP.com/us-en/product/HP-15-D000-TouchSmart-notebook-PC-series/6627588/model/6761859/manuals

  • Steps to remove and replace the keyboard. HP Pavilion dv7-1448dx

    Hello. I have HP Pavilion dv7-1448dx. I have not available a manual where the path is directed to change the laptop keyboard. I need help to get the steps to remove and replace the keyboard. Please provide me with the support as soon as possible so that I can solve this problem. Thank you.

    Link to the .pdf manual

    Click above. We are not HP, all other users trying to help.

  • Remove and reinsert the battery to reboot the computer from sleep mode

    When the computer goes into mode "sleep" due to inactivity, it cannot be started again until I completely remove and reinsert the battery. It is an Acer laptop with Windows 7 OS

    Hello

    References to Vista also apply to Windows 7.

    1 I want to erase the General corruption and repair/replace damaged/missing system files:

    Start - type this in the search box-> find COMMAND at the top and RIGHT CLICK – RUN AS ADMIN

    Enter this at the command prompt - sfc/scannow

    How to analyze the log file entries that the Microsoft Windows Resource Checker (SFC.exe) program
    generates in Windows Vista cbs.log
    http://support.Microsoft.com/kb/928228

    Run checkdisk - schedule it to run at the next startup, then apply OK then restart your way.

    How to run the check disk at startup in Vista
    http://www.Vistax64.com/tutorials/67612-check-disk-Chkdsk.html

    -------------------------------------------

    Check the settings (BIOS/CMOS) that you can start and ensure that this suite of lan, Wake on modem and
    similar are not enabled.

    Shoot sleep problems - hibernation
    http://www.computerperformance.co.UK/Vista/vista_hibernate.htm

    How to solve a problem of Mode for Vista and find a Solution
    http://www.Vistax64.com/tutorials/63567-power-options-sleep-mode-problems.html

    How to enable and disable Hibernation - you can try to disable and re-enable the it. http://www.Vistax64.com/tutorials/165508-hibernation-enable-disable.html

    How to restore the default power in Vista (and then go back and change as you wish)
    http://www.Vistax64.com/tutorials/198047-power-plan-restore-default-settings.html

    How to troubleshoot performance problems with sleep, hibernation and resume in Windows Vista
    http://support.Microsoft.com/kb/950686

    Panel configuration-Device Manager - look at the settings for the network card, WiFi, Modem power management.
    and other devices. (Double click on the device and the power management tab)

    Panel configuration-Control Panel Home view (non-conventional) in the top-right search pane
    type of hibernation - see turn Hibernate on / off

    All the default power plans and then set them as you wish.

    I hope this helps.
    Rob - bicycle - Mark Twain said it is good.

  • G61 does not illuminate unless I have remove and replace the battery.

    Even when the power cord plugged in it will not light. If I remove and replace the battery it lights mode battery and AC. At the same time my HP Support Advisor and HP s Advisor "stopped working".

    I restore to a previous point, no help. Downloaded a new HP advisor, ho help.

    This happened after the recent big WIN7 updated. Help

    Hello

    In the Menu start, open the all programs, open accessories, right-click on command prompt and select "run as Administrator".  In at the prompt, type the following command and press ENTER.

    sfc/scannow                (Note that there is a space between sfc and /)

    Let the entire process, then the output type and press ENTER.  Stop the laptop, unplug the AC adapter unplugged, remove the battery and then press and hold the power button for a minute.

    Now, plug in the AC adapter without the battery inserted, start Notepad, open windows control panel, open Device Manager, expand the entry for the battery, on the right, click on and compatible Microsoft ACPI control method battery and select Uninstall - do uninstall not something else here.  When the uninstall is complete, shut down the PC, unplug the AC adapter, reinsert the battery and then start the PC on just the battery.  Windows will automatically reinstall the driver - leave Windows running for a few minutes. Shut down the PC again.  Now plug the power adapter (with the inserted battery always) and start the laptop to see if it helped the issue at all.

    Kind regards

    DP - K

  • How to remove and delete the in computer HP recovery Partition.

    Hello

    How to remove and delete the Partition Recovery on HP computer after I installed win 7 (clean install) befor was Vista?

    Thank you


  • How to remove and replace the missing keys Sat A30

    Hey folk,
    I guess that sounds simple, but I have just no idea.
    Broke and need to replace a couple of keys on my keyboard UK A30. At present, all what I have in place are the rubber bubble popper & locators of metal set in the empty spaces.
    The keys in question are the shift (I have no u lying in spring form) and? + / keys of RHS of KB.

    I have complete German and American replacement KBs, but to remove the necessary keys on the part and repair the United Kingdom KB.

    I don't want to end up with 3 broken KBs

    So I need clear and detailed instructions on removal and then reset the necessary keys.

    Any help or direction to the site that contains this kind of info would be greatly appreciated. Or response message directly by email to

    [email protected]

    Thank you very much.
    sparkiefive

    Hello

    I think you should go to a Toshiba Service partner.

    You can find them here:
    https://EU.computers.Toshiba-Europe.com
    Downloads support & - find an approved service

  • Can I remove and reinstall the font without records book?

    On my MacBook Pro 10.6.8 FontBook operates as a two-bob watch - do not let me access policies in Freehand MX that are definitely in the font book, among other things. The operating system used on 10.6.3 and I upgraded to 10.6.8 via a Mac/PC independent shop, so I have no 10.6.8 discs (I have the original 10.6.3 discs).

    Is it possible to throw the font book in the trash and the re - download online? Or I can reinstall it from my 10.6.3 drive...?

    Thanks in advance!

    To clarify, there was never a 10.6.8 released on record as an installable OS. You install 10.6.3 (the last version released of the snow leopard), then apply the 10.6.8 Combo Update.

    What you see, is very typical of a corrupted font book database. Replace the app does nothing to remedy.

    Follow 1 a or 1 b depending on the version of Mac OS X you have. If you can't find the com.apple.FontRegistry file in your user account preferences folder, then it is easier to use 1A rather than trying to dig through several hidden files.

    1 a) restart your Mac and immediately press and hold the SHIFT key when you hear the startup chime for a safe boot. Now keep the SHIFT key until OS X asking you to sign in (you will get this screen on a Safe Mode boot, even if your Mac automatically connect). Let the Mac has finished boot to the desktop and then restart it normally. You can release the SHIFT key right here. Yosemite is a little different. Whether a boot Safe Mode or a regular, you get the same progress bar. It takes just as long to reach the office in Mode safe. Then hold the SHIFT key until you get to the desktop. This will delete the font book database and cache files for the account you logged in Mode safe. Restart again normally.

    1 (b) for a period of time, the font book database file, com.apple.FontRegistry, was buried deep in the private/var/folders/.../-Caches-/ folder. In later versions of Mac OS X, it is much easier to remove. Quit the font book. Open the Preferences folder in your user account, put the com.apple.FontRegistry file in the trash and restart. More fast than method 1 where you will need to restart twice. If you are using Snow Leopard, use 1 a method because this file is located in the private hidden folder.

    Leopard or an earlier version, font sets, that you have created will be gone. In addition, all the fonts in the main three folders of fonts (System, library, your user account) will now be active, regardless of their status beforehand. In Snow Leopard, your games will remain intact.

  • Email that can be removed and freezes the computer when you try or when you scan up to this particular email when opening other emails. Other emails are very good and can open and delete them.

    I have an email on Outlook Express, which leaves me the delete (distribution of the mail... Mail delivery failed).  Whenever I try to delete or scan down to it, it causes my computer to freeze and have to go out and come back and work with my emails.  All other emails can be read and deleted.  How can I remove this email? I have Windows XP and uses a Compacq computer.  There is also a small icon of trombone to the left of this message.  Thanks for any help you can give me.

    Try to go to view | Layout and turn off the preview pane, so that the message does not open when you select.  Select the message and press and hold the SHIFT key and press the Remove button to remove it permanently.  See if it works.

    Steve

  • HOW TO REMOVE AND REINSTALL THE OFFICEJET PRO 8500 910 PRINTHEAD

    HP OFFICEJET 8500 910 PRINT HEAD ALIGNMENT FAILED. HOW TO REMOVE & REPLACE THE PRINT HEAD. I READ THE USER GUIDE THAT SAYS LIFT TOP AND THEN LIFT THE PRINTHEAD. UNFORTUNATELY WE YOU SAID NOT HOW TO PROCEED. I OBVIOUSLY DON'T WANT THE LID ON THE GLASS... THE PHOTO SHOWS TOP RAISED COVER AND ACCESS THE PRINT HEAD. HE DIDN'T THERE HAS NO ACCESS TO THE PRINTHEAD WITH THE LID RAISED!

    Hello

    Please click http://support.hp.com/us-en/document/c02257580 to access the procedure which should solve the problem.

    Please refer to two Solution.

Maybe you are looking for

  • What are the toolbars? I can't use the browser without them.

    The old toolbar at the top is now gone. I lost the print, preview mode although there are another way to print. I can't use bookmarks because it allows me to not put the bookmark in the right place. It is not an improvement; It is a net loss, and it'

  • Pinch zoom opening and closing (mac) does not work in the last beta update

    Anyone know why pinch open close to the pavement of mac suddenly not zoom the last updated beta?

  • Won't install Bluetooth drivers

    During the installation of the drivers for bluetooth I get: error 1309, cannot read the file C:\SWSetup\sp64156\Win7\AMD64\program files\Ralink Corporation\Ralink Bluetooth Stack\driver\m76usb\devcon64.exe. The system is M6-ko22dx sleeekbook Win 8.1

  • QNaN

    Experts of LabVIEW, I have a question of arithmetic on QNAN and typecast.  I wrote the code that's going to take a hexadecimal string and convert it into a floating point number.  For example: hex: 0000C0C3 I swap the bytes to reach C3C00000, the int

  • My computer crashed and now my files and saved emails went to outlook express.

    so, my computer crashed and now all my info stored in outlook express, such as e-mail and records have disappeared.  I had done a backup of my documents before the computer has crashed on a portable hard drive, files and emails to be there? I looked