Have a main.mxml with an init() function in which I want to add an eventListener for a button. The button exists in other than the opening state, therefore my app crashes.
How do I define an actionScript listener for this button? I'm used to doing this in mxml but I'm converting my work to classes.
you are calling init before the button has been created
easiest way is instead of using includeIn use the visble property so its created but not visible so you can attach a listener
<s:Button visible.firstState="false" visible.secondState="true"...
or listen for the creationComplete event on the button
I'll try the visible method for now and look up creationComplete suggestion shortly.
Youve been very helpful on a number of issues.