Skip to main content
Participant
August 6, 2009
Question

Using my own responder with Async

  • August 6, 2009
  • 1 reply
  • 1661 views

We have our own DAO layer in our application and we have extended Responder with MyResponder.  We added some specific features to MyResponder that fits into our framework nicely.  Our DAO layer has functions like

public function findByID(id:String, clientResponder:MyResponder, tokenMap:IMap) : void

This framework is heavily code generated and extremely flexible (obviously I'm leaving much out that is not important to this post as well as the fact we are extending at the interface level also).

I want to create a FlexUnit to make the async call to my UserDAO.findById("123", MyResponder);  But, Async.asyncResponder returns IResponder so I can not pass that into my DAO which required a MyResponder.  So how do I extend FlexUnit so that I can have Async.asyncResponder return a MyResponder object?  MyResponder does implement IResponder ultimately so as long as I can somehow make the implementation returned from asyncResponder be a MyResponder then I'm golden as I can simply cast the return to MyResponder.

Rereading this I'm not sure if I explained my need well so hopefully you can understand it.

Thanks.

This topic has been closed for replies.

1 reply

Participating Frequently
August 6, 2009

It's doable

Take a look at the AsyncTestResponder . You will need to make one of your own that is a MyResponder instead of just an event dispatcher.

Then look at how the async.asyncHandler method works. It basically calls back into the code in the ExpectAsync class( in this implementation). That is where the current AsyncTestResponder is. You would need to replciate some of this, but it is feasible. If you want to file an enhancement request, we might be able to find an easier way for you to slide this in place.

Mike

Participating Frequently
August 23, 2009

I have a solution but it has a caveat.

Take a look at the bug when you have time and comment

https://bugs.adobe.com/jira/browse/FXU-62

Mike