How Does the Shared Cursor Work?


The Shared Cursor traces your mouse movement using Flash's onMouseMove method. The component copies the x,y values to attributes within a remote SharedObject. When the data is copied , other Flash players are notified and can re-create your mouse and position. This allows you to "track" the mouse activity of connected users. Each user has a slot created within the SharedObject on the server. When data changes within the slot, notifications are sent to each connected client. The notifications are handled by the Flash player by setting the local x,y property to the value of the changed slot (or user ). It's a handy tool that uses a simple concept and a great technique for handling data on the server. More will be discussed on the slot concept and the structure of the SharedObject after the next exercise.

The WhiteBoard uses Flash's drawing methods to create arrows and text annotations on the Flash stage. Other Flash players that are connected can see what is happening and add their annotations. Although there is a lot more going on with this application, the basic principle is the same. Each time a line is drawn the WhiteBoard component dynamically creates a new slot within the SharedObject on the server. This is why you can click a line and move it around. This process calls a series of special WhiteBoard methods that draw the new object on other Flash players.

We won't get into reverse engineering the components , but it is important to understand how it all works. In Exercise 8.2, you will use the SharedObject to share MovieClip properties, but first let's look into how the Flash Communication Server synchronizes everything.



Macromedia Flash Communication Server MX
Macromedia Flash Communication Server MX
ISBN: 0735713332
EAN: 2147483647
Year: 2002
Pages: 200
Authors: Kevin Towes

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net