Nonpersistent Client-Side Remote Shared Objects
(Page 1 of 4 )
If you haven't yet explored the possibilities of shared objects in applications, you're missing out on one of the more important ways to exploit the capabilities of the Internet. Keep reading to learn how you can use shared objects in your web applications. This article, the first of two parts, is excerpted from chapter four of
Learning Flash Media Server 2, an O'Reilly PDF Book. Copyright © 2008 O'Reilly Media, Inc. All rights reserved. Used with permission from the publisher. Available direct from O'Reilly Media.
Sharing Data on Multiple Connections
The first time I encountered the remote shared object I thought it had to be the most important contribution to the Internet since the invention of the browser. That opinion has changed little over the years, especially in the case of any application that needs to send data and interact with others in a “live” situation.
So what are shared objects and what are they used for? Summarized, shared objects are objects that can be displayed and controlled on one browser and seen on another. So if you have an application that displays text using a text input field, you can display that text in both your own browser as well as in all others who are looking at the same application. Besides text, you can move movie clips on one screen and they move on other screens. You can click a button on one browser to launch an event on all browsers using shared objects.
When a shared object is set up in a FMS2 application, it sets up a “subscription” that others who have launched the same application automatically subscribe to. Think of shared objects as magazines and everyone who logs on gets a subscription to the magazine. The “magazines” are delivered in the form of real-time data. So, if you’re sending (sharing) the text in a text field, as soon as you enter the data, it’s seen on the remote computer.
Persistent and Nonpersistent Shared Objects Nonpersistent shared objects are something like variables. When you quit an application, all of the values in the variables disappear. They’re nonpersistent. In the same way, the data in a nonpersistent shared object is lost as soon as the users leave the application.
Persistent shared objects are more like data in a database. The data from persistent shared objects is stored on the server’s hard drive, and hence, persistent. When you have data that you need to access from different sites, persistent shared objects are very handy. However, this chapter only deals with nonpersistent shared objects. In another chapter where more advanced shared objects concepts are discussed, both server-side and persistent shared objects will be examined.
Uses of Nonpersistent Remote Shared Objects While any list of nonpersistent remote shared objects will fall far short of their possible uses, the following list gives you an idea of how they can be used:
- Remotely controlled slide show
- Text chat
- Games with opponents at different sites
- DJ Application where songs are remotely selected and played
- A doorbell
- A live online auction
- Customer service application
With these applications in mind, we will begin looking at how to create and use shared objects with FMS2.
Next: Instantiating Remote Shared Objects >>
More Flash Articles
More By O'Reilly Media