Even though I started coding in flash I know what you mean. The way I do it is like this:
I have a Red5Connection class that extends NetConenction, much like that in the examples. In my actual app I have another class that extends Red5Connection and has some callbacks defined that get called from red5. The connection class is held and listened to a custom BroadcastExpert model that pushes the events into the subscribing views. The thing is that I'm using Flash8 with PixLib. I guess in Flex you would use Cairngorm. The whole idea is to get the remote method call and the onResult in a Command. That does the trick of managing compelxity for me. For chained calls you would build a custom CommandsQueue I guess. Pixlib has one for remoting but I didn't need it yet. I hope the above helps in some ways, cosmin > My concerns are more about the control flow than the data. I have some > usecases where I'd have to call two or three remote methods in a row which > means that I'd have to call the next method in the onResult handler of the > previous one which obfuscates the application flow a lot. > I could "solve" this by providing additional server-side methods which > aggregate such control flows on the server side, which on the other hand > means, that I'd have to pass more data at once without knowing if all the > data is needed (because the control flow now happens on the server). > > The second more problematic aspect is error handling. I cannot throw an > exception in the onStatus handler to jump out of the regular control flow. > As onStatus seems to be called from deep inside the flash players message > loop it is not part of my applications call stack and exceptions thrown > within this handler cannot be caught in actionscript. > > I'm trying to learn Flash and Flex since two days now, so maybe I'm not > fully aware of all best practises, but for now everything I've seen so far > seems like a whole big unstructured mess compared to everything else I > used > so far. > > harald > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf > Of [EMAIL PROTECTED] > Sent: Friday, September 07, 2007 2:59 PM > To: [email protected] > Subject: Re: [Red5] FW: synchronous method invocation > > Nope. > All the remoting stuff is async. > Best to push the info from call results into a model (mvc) to manage > complexity. > > cosmin > >> hi, >> >> is there any way to let NetConnection calls behave synchronously? >> needing all those two-liner callback methods somehow smells like >> trouble in a reasonable complex application. >> >> cheers, >> harald >> >> >> _______________________________________________ >> Red5 mailing list >> [email protected] >> http://osflash.org/mailman/listinfo/red5_osflash.org >> > > > _______________________________________________ > Red5 mailing list > [email protected] > http://osflash.org/mailman/listinfo/red5_osflash.org > > > _______________________________________________ > Red5 mailing list > [email protected] > http://osflash.org/mailman/listinfo/red5_osflash.org > _______________________________________________ Red5 mailing list [email protected] http://osflash.org/mailman/listinfo/red5_osflash.org
