Using events in general is better than callbacks because you can have more than one callback registered, and the event type determines the parameters.
You can also register callback objects and not callback functions and require that the callback objects implement a particular interface which defines the function signatures at compile time. ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Ralf Bokelberg Sent: Wednesday, October 17, 2007 11:24 AM To: [email protected] Subject: Re: [flexcoders] Need alternative to callbacks? What about adding unit tests? This would allow you to verify the signatures without running the actual application. Another possibility is to use a parameter object, so that all the callbacks have the same parameter. (this is basically how event handlers work) function myCallback( payload : Object ) { var specificPayload : SpecificPayloadClass = SpecificPayloadClass ( payload ); specificPayload.specificProperty ... } Cheers Ralf. On 10/17/07, wwwpl <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: We would like to get rid of callbacks in our project. Recently I had to change about 15 different callback function signatures. It took a long time to get everything working again because the problems had to be found at run time instead of compile time. Does anyone out there have a good solution to replace callbacks? It would be nice if Flex did signature checking at compile time for callbacks. -- Ralf Bokelberg <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > Flex & Flash Consultant based in Cologne/Germany Phone +49 (0) 221 530 15 35

