Chapter 8. STEP 8: Collaboration with SharedObject()


Chapter 8. STEP 8: Collaboration with SharedObject()

If you think you've seen everything, take a deep breath because the information presented in this chapter will compound your possibilities. The power of Macromedia Flash Communication Server MX lies in the new and powerful scripting architecture, SharedObject. SharedObject is a synchronized data storage and messaging structure that employs a standards-based object-oriented programming model. SharedObject was introduced originally in the release of Macromedia Flash MX and is very similar in context to any ActionScript object model.

When used with the Flash Communication Server, a remote SharedObject is used to store data on the server. Being on the server, each Flash player client has access to the data structure stored within it. This object is the cornerstone behind the Communication Server architecture because of its unique synchronization event. When data within a SharedObject is added, modified, or deleted, each Flash player connection can be immediately synchronized with the change. The best example is a simple chat tool. A chat tool uses the remote SharedObject to enable each Flash player to append data to the collective data store. When a new message is added, each connected Flash player is updated with the change.

SharedObjects are also available without using the Flash Communication Server. The local SharedObject is very similar to an HTML cookie. This SharedObject is written to the hard drive of the client computer. If the SharedObject is persistent (meaning it doesn't get deleted), it can be accessed whenever the Flash player is run. The privacy window that appeared when your camera was accessed in Chapter 4, "STEP 4: Simple Chat and Video Conferencing," appears again when you use local SharedObjects. This is a feature of the Flash player that allows a user to allow or deny this activity plus limit the hard disk memory available to the Flash player.

Persistence with a Remote SharedObject allows data to exist even if there are no connections. A Flash player can be resynchronized after a period of disconnect using a persistent SharedObject. Data in persistent SharedObjects are actually stored in an FSO file on the server within a folder created by the server called SharedObjects. This folder is stored within the application instance folder. Storing the data in a file allows the data to persist when all clients have disconnected or even after a reboot of the server! Remote SharedObjects can also be non-persistent and are allocated to temporary memory spaces on the server. When all clients disconnect, the application is reloaded, or the server reboots, these SharedObjects are deleted.



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