Home arrow Flash arrow Page 2 - Nonpersistent Client-Side Remote Shared Objects

Nonpersistent Client-Side Remote Shared Objects

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.

Author Info:
By: O'Reilly Media
Rating: 4 stars4 stars4 stars4 stars4 stars / 4
January 08, 2009
  1. · Nonpersistent Client-Side Remote Shared Objects
  2. · Instantiating Remote Shared Objects
  3. · Inspecting a Shared Object
  4. · Minimalist Project for Shared Movie Clip

print this article

Nonpersistent Client-Side Remote Shared Objects - Instantiating Remote Shared Objects
(Page 2 of 4 )

This chapter is going to demonstrate three different remote shared objects with minimal code. The first will be a pointer that allows you to point to any location on another personís page. This kind of pointer can come in handy if youíre making a presentation to a remote location and you have to point out different things to the audience. Second, you will see how to make a minimal text chat where the text entered into an input text box shows up on all of the usersí screens. Finally, using a shared movie clip, you will see how to open up web pages on remote viewersí screens. These are all minimal examples, but they show how you can do different things with remote shared objects. The rest is up to your imagination.

First, though, note that instantiating a shared object is a little different than most class instances. The general format for instantiating a shared object is shown in Figure 4-1.

Figure 4-1.  Instantiating ShardObject class


Generally, itís a good idea to set the scope of the shared object by simply declaring the shared objectís name and data type, such as:

  var my_so:SharedObject;

If your declaration is at the top level you can do the actual instantiation in different scopes. If you want to use a single step for the instantiation and declaration, you would use the format:

  var so:SharedObjec=SharedObject.getRemote(string,uri);

Setting Up Shared Object Storage: Slots

When you set up a shared object instance, you need to set up a storage system based around the objectís dataproperties. By assigning different attributes to thedataproperty you can create slots using most kinds of data types. The following shows a simple data slot:

  var memberName:String= name_txt.text;
  so.data.nameNow = memberName;

The shared object has adataattribute,nameNow. So it now has a storage slot for a string name that can be shared with others connected to the same application. In the same way, you can set up as many slots as your application needs, using the appropriate data type for the data to be stored.

blog comments powered by Disqus

- More Top Flash Game Tutorials
- Top Flash Game Tutorials
- Best Flash Photo Gallery Tutorials
- The Top Flash Tutorials for Menus
- 7 Great Flash Tutorials
- Adobe Creative Suite 5.5 Now Available
- Critical Flash Vulnerability Heats Up the Web
- More on Nonpersistent Client-Side Remote Sha...
- Nonpersistent Client-Side Remote Shared Obje...
- Using the Decorator Pattern for a Real Web S...
- Using Concrete Decorator Classes
- Delving More Deeply into the Decorator Patte...
- The Decorator Pattern in Action
- A Simple Decorator Pattern Example
- Decorator Pattern

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials