Search code examples
actionscript-3flashair

How can I display which Event strings are available for an object in AS3?


I see that in an ide like FlashDevelop, when I add an event listener to certain objects, it'll auto-populate with the event strings that this object will dispatch (I'm assuming, anyway). I'd love to do this with my custom objects (esp. when it comes to sharing this code with co-workers), to clear up possible confusion as to what to listen for.

Does anyone know how to discern which events will be dispatched?

Thanks,


Solution

  • I don't think there is a way to link suggestions to a method call as strictly as exists with the inbuilt stuff like addEventListener(), but that shouldn't stop you from producing perfectly readable code for you and your colleagues (especially if you are using FlashDevelop).

    For starters, using your own event class with static properties representing the event strings you can use will provide a useful code hint by default:

    enter image description here

    From here, you can add code comments that work with FlashDevelop to produce a very precise tooltip:

    enter image description here