Professor FCS (part 3)
I've been seeing a bit of a better demand lately on my site for information on FCS. It seems FCS is picking up a bit better now in Japan which of course leads to lots of questions... And boy do I have answers! well.. most of the time. :)
Currently I have about 19 tutes up on FCS, but because it's not such a hit yet here (lack of japanese hosts, high cost, and no info anywhere.. a bit on MM Japan's site) I haven't posted anything coming close to "advanced material". Though I'd like to change that, and it finally seems like there is a demand for it coming through.
The latest question I got was how to call a function that is in another client's movie. Of course being able to do that brings all kinds of options to the board, the most basic being maybe a URL opener, to something more along of lines of letting the user know that somebody (passing the username too) is trying to get a hold of them and to open up their video window to have a conference. Or something along those lines :)
I'm not sure exactly what the user is going to use it for, but the goal is quite clear I think. So how do you teach something like this? There are of course a series of steps to take to acquire this ability to send commands to a particular user and not all or a group. It wouldn't do to send a request to a user, to find out that it got sent to the wrong user, let alone to all users!
I originally explained on the forum to the user the steps that are required to accomplish this.
1. Give the user a unique ID that you can use later to pinpoint them
2. Setup an event handler to know when you have chosen a user and want to send them a command
3. Setup a receiving function in the movie so that when somebody calls it, it will do something.
There are more points but this is where it gets a bit sticky because there are at least two ways to do this. There are good points and bad points to them too. I'll try to explain the main two ways here:
The first way that we have is to setup functions on the caller side to send the call with the callee ID, receive that on the server side and then send it off to the callee but matching up the ID to one of the connected users. This is the best way. Why? because now you have control over what is happening. If you wanted to, you could even log that in a central location! I've explained this bonus in this post. The down side? well.. you have to be able to use server side script. It requires a server side script to run and requires processing power of the server (which maybe isn't so bad).
The other option we have is to have all connect to a "command" shared object. Using the send() method you can send calls to functions that are connected to the shared object on all users. The upside of this? well, it's all done on the client side. You don't even need to use server side script. If I was going to hijack somebody's account (which I wouldn't) I would use this method :D . You don't need to know SSAS and there is no need for a server side file. The bad side? besides the fact that it's not controllable centrally, the function get's called to everybody. If all receive the call, they all have to check if they are being called or if it's for someone else, if so then ignore it. This takes up cycles on the client side (not good) and sucks up more bandwidth in the end.
It so happened that last night the user that was wondering on the above issue popped into the on-site chat app I have up and asked another interesting question on how to get his video to show up on somebody elses screen. This surprised me a bit as it isn't so tough and ended up taking out about 10 minutes to explain it in detail of what to publish and play. Using the "shared notepad" I have hooked up to the chat, I wrote out the required script for him as he watched on hmming and hrmming ;). It's cool to see people grow and realize new things when you can give them some info on whatever they wanted to know. You can almost see their eyes light up in recognition of what is going on, and off they go to try out this new idea.
I ended up writing a tute on using the server side script style and am waiting patiently for questions that I hope come so I can delve into it a bit more. We'll see where it leads to.
Posted by Graeme at January 29, 2004 02:56 PM