This content has been marked as final. Show 5 replies
I dont think there is anything wrong with using multiple remote objects, you could also as you asked use a function on result to figure out what needs to occure and where the data should go but 2 remote objects would seem a bit easier
I would prefer to only use one remoteobject (I think).
How can I do this.
Or is it better to use multiple remoteobject for eatch cfc call?
You need to look into the ACT pattern. It allows you to set properties an an AsyncToken object when you call the data service, then access the property values when the data is returned in the generic result handler.
One easy solution is to set a string id value when you make the call, then, in the resultHandler, use a switch statement based on that id to process the call results as you wish. You can even put a callback-like function itself in the AsyncToken property.
Look for ACT (Asynchronous Call Token) in the docs.
I'm pretty new to flex two too, but I think the problem is in your data handler. Is that where you are populating the datagrid? You are passing the results from both RemoteObject calls to the same data handler, and they are behaving the same way. Try creating a queryDataHandler(event) and a arrayDataHandler(event) function, and point each of them to a different dataGrid. I guess you would have to make two RemoteObjects, but that would get it done quickly and it wouldn't be too dirty.
I don't know if that is according to best practices, but it should work.
You want to do something like this?
<mx:method name="sayHelloString" result="handleHelloResult(event)"
<mx:method name="sayGoodbyeString" result="handleGoodbyeResult(event)"
<mx:method name="sayGetLostString" result="handleGetLostResult(event)"
You seem to know the code to call the functions properly, and handle the results, so I won't be redundant - let me know if I didn't answser your question fully.