If you are reading this article you will probably have had some experience with Flash Communication Server already. Maybe you have even had a go at building some nice apps and maybe you have come across an issue which I have encountered recently:
I wanted to 'pause' my application, let a user log out and terminate all broadcasting from that user without forcing her to close her browser. Instead I wanted to provide a 'log out' button.

My FlashCom application was being loaded via loadMovie() into another movie I though that simply unloading it on releasing a button would work. It didn't.

on (release) {

Ok, it unloaded the movie alright but the netconnection appeared to be still open as I didn't explicitly disconnect it. The weird thing was that even when opening Google in one browser window and then closing my Flash window down completely I could still hear other user's broadcast and was clearly still connected to the application!

I must add at this stage that I was using Macromedia's pre-built components (although they were slightly modified). If you have had a look inside these components you will know that their internals are quite complex.

In the end it turned out that adding a new function (courtesy of Sam Wan) to the simpleconnect component did the trick.

It was necessary to
modify the code on frame 1 inside the SimpleConnect component by adding the following new method to the FCSimpleConnect Class, I slotted it in on line 182 of the actions layer.

FCSimpleConnectClass.prototype.shutdownApplication = function() {
   for (var i = 0; i<this.fcComponents.length; i++) {

I won't go into too much detail as to how this new method works but what it achieves is to disconnect all connected components (such as AVPresence, Chat, ConnectionLight etc.).

My SimpleConnect component instance was named 'simple_conn' and was sitting on the same timeline as my button which contained the disconnect action. Therefore all that was needed for the button action was:

on (release) {
   // add more actions here if needed
   // ie gotoAndStop("disconnected")

Now if a user clicks this button it will call shutdownApplication() inside the SimpleConnect component which in turn will disconnect the user. Excellent.