You probably solved this by now, but…

 

This isn’t really a problem with the delegate pattern, it’s more that access to the RemoteObject itself isn’t working.  My guess is that your MyDelegate is getting created before the MyServices component, therefore it doesn’t have access to everything.  I bet if you did a check you’d see that mx.core.Application.application.MyServices.MyCFC is null when you tried to assign it.

 

Matt


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Stewart, Ryan
Sent: Monday, August 08, 2005 8:11 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Trouble with Delegate Pattern

 

I am using the design patterns from Cairngorm and Chapter 20 of the Developing Rich Clients with Flex book (though I’m not using the actual Cairngorm framework).  I have a problem that I’m not sure how to debug and I’m not exactly sure what parts of my code I should post, so I’ll explain the issue and maybe someone can help me narrow it down.  I’m kind of an ActionScript newbie, so I may just be in over my head.

 

In my delegate file, I can’t set the delegate to anything past mx.core.Application.application.  In my functions I have to actually type out the path to my services and CFC.  I have a function that creates the delegate:

 

      public function MyDelegate(commandCaller:Responder)

      {

            this.my_delegate = mx.core.Application.application;

            this.my_responder = commandCaller;

      }

 

And then I have my operation calls on the CFCs:

 

      public function MyCFCMethod():Void {

            var pendingCall:Object = this.my_delegate.MyServices.MyCFC.MyCFCMethod();

            pendingCall.resultHandler = Delegate.create(this.my_responder, this.my_responder.onResult);

            pendingCall.faultHandler = Delegate.create(this.my_responder, this.my_responder.onFault);

      }

 

If I try to use this.my_delegate = mx.core.Application.application.MyServices.MyCFC in the MyDelegate() function, and then use this.my_delegate.MyCFCMethod() in the MyCFCMethod function, it won’t make the connection to the CFC (The netConnectionDebugger shows a connect event, but no call event).

 

Any idea what might be causing this?  I know this is a really open-ended question, so any small piece of advice for helping me track the issue down would be much appreciated.

 

Thanks in advance for your help,

 

-Ryan Stewart




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to