Ok…I blogged about this a bit ago and wanted to do a quick follow-up post. In the aforementioned post (always wanted to use that $10 word; lol) I pointed out how certain functions (onBWDone, onFCSubscribe, etc) are required in the current client so the server can call them, as needed.
So, the way to do it was to set the myNetConnection.client = this;. Well, that’s still very relavant but it has been SERIOUSLY irritating me on a cleanliness level. Here is why:
public function onBWDone(… rest):void{ … }
Can you tell why it is irritating? PUBLIC!! Now my media connection class has, what seems like, a new function added to the API. ๐ That bites! I’m the only one writing code against it so it isn’t a big issue.
After a few weeks of doing my best to ignore my now public event handler I run across something in LiveDocs.
myNetConnection.client = new Object();
DUH! ๐ I thought about it initially but I have each of those handlers dispatching events/making other calls so I didn’t want to mess with that. Seeing as you can say _new Object()_ that means you could say new MyCustomClient() and have it do whatever you want.
Bottom line: You don’t have to set the client property to this but you can set it to a “custom object” or a custom class. Just a quick tidbit.