Cairngorm Delegate


/ Published in: Other
Save to your folder(s)



Copy this code and paste it in your HTML
  1. /** *******************************************************************
  2. * MySnippets
  3. * Free for use
  4. *
  5. * @author Jonnie Spratley
  6. * @contact [email protected]
  7. ******************************************************************* */
  8. package
  9. {
  10. import com.adobe.cairngorm.business.ServiceLocator;
  11.  
  12. import flash.utils.ByteArray;
  13.  
  14. import mx.rpc.AsyncToken;
  15. import mx.rpc.IResponder;
  16.  
  17. /**
  18. * The Business Delegate delegates all the responsibility for the
  19. * business logic that must locate a service, and then invokes
  20. * a method on the service.
  21. *
  22. */
  23. public class Delegate
  24. {
  25. private var responder:IResponder;
  26. private var service:Object;
  27.  
  28. public function SnipprDelegate( responder:IResponder )
  29. {
  30. this.service = ServiceLocator.getInstance().getRemoteObject( "MyService" );
  31. this.responder = responder;
  32. }
  33.  
  34. /************** ServiceCalls ********************/
  35. public function getData():void
  36. {
  37. var token:AsyncToken = service.getData();
  38. token.addResponder( responder );
  39. }
  40. }
  41. }
  42.  

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.