I'm having trouble with addEventListener()... I think.
I'm building an app that is a system tray icon with a menu. Right-click the icon, choose an option from the menu and cool stuff happens. One of the options opens a configuration screen. This configuration screen allows the user to add server names and addresses. These server names are then stored in a file along with the addresses, and added to a dynamic submenu. In other words, the user configures the app to know about three servers, and this dynamic submenu will contain those three servers.
The problem comes when adding the event listener at the time of menu creation. The menu creation happens just fine and items are added or removed from this dynamic submenu without problem... but the event listener isn't working.
However, if I restart the application (which reads the configuration from the drive, and builds the submenu using the **exact same code**), the event listeners work just fine! I'll reiterate -- the code which builds the submenu on application launch is the same code that dynamically rebuilds the submenu on-the-fly.
Here is the relavent code:
I am not getting any errors, just unexpected behavior. As a debugging measure, I even put a trace after the addition of the event listener to check the value of my.submenu.items[my.i].hasEventListener(air.Event.SELECT)... and it's true both at application launch, and after destroying / recreating the menu after the user changes the configuration data.
Any help would be appreciated.