How do I add eventListener to the button in a view state

Hello

Have a main.mxml with an init() function in which I want to add an eventListener for a button. The button exists in other that the State of opening, so my application crashes.

How to define a listener of actionScript for this button? I used to do this in mxml, but I convert my work to the classes.

Thank you

Kristin

you call init before the button was created

average the most simple is instead of using includeIn, using folded property then its created but is not visible, so you can attach a listener

or listen to the event creationComplete on the button

Tags: Flex

Similar Questions

Maybe you are looking for

  • My connection is not suitable

    I don't have reliable internet access now update my operating system via the appstore so decided to download an OS X El-Capitan 10.11.3 disk image but I can't find it on apple's site, and I don't know why.

  • HP envy 4500: hp envy 4500 printer cable

    I just bought this printer. I was originally a printer needs to be connected, but there, everything seems to be wireless. I have wireless in my office. I understand that I can connect it to my laptop with a cord. I'm looking for what type of cord.  T

  • Keyboard/cursor problems.

    I have an ASUS E - pad Transformer 101. As I type on my keyboard, the cursor continues on to go somewhere else on my screen, so that if I'm not careful, I will be typing in somewhere else. It is very annoying... If someone has had this problem or kno

  • Recent upgrades: KB2419640, KB976902, KB890803 when installed I can't start and get the blue screen.

    After that the installation of upgrades KB2419640, KB976902, KB890803 I'm unable to boot.  I get the blue screen.  I used chkdsk, memtest etc. No problem.  I disabled the upgrades to prevent settling.   I'm not comfortabel thereby.  Is there a soluti

  • U2413, no USB connection, insert an SD card

    The issue seems to be the same as in this link: en.Community.Dell.com/.../19629584 I got the Dell Ultrasharp + X-rite i1 Display Color Calibration work for some time (I use a Dell laptop), but now the calibration SW complains about the connection of