More on Nonpersistent Client-Side Remote Shared Objects (Page 1 of 4 )
Minimalist Project for Shared Text
Having seen a minimalist project for a movie clip, we’ll now look at one for sharing text. The concepts are essentially the same, but instead of basing the changes in the shared object slots on the movement of the mouse position on the stage, the changes are based on typed input by the user.
In this application, the user changes the value of the shared object property attribute (text content) by typing in the value and pressing a button to fire a function. The function enters the value of the text input field and assigns that value to the shared object attribute. Here are the basic elements of the project.
Objects Dynamic Text Field (1)
Input Text field (1)
Button Component (1)
Follow these steps to create the application:
In the server-side FMS2 root, create a new folder and name it zbasicSO. (This is the same server-side folder used in all of the applications in this chapter, and if you have it in place already, you don’t have to add another one.)
Open a new Flash document and set up the following layers, from top to bottom: Actions, Text Fields, Button, and Label. Lock the layers.
Unlock the Button layer and add a button beneath the smaller of the two text fields. Provide the button with the instance namesend_button. It will be used to trigger the change in the shared object. Lock the layer.
When you test this application, you will need to run two copies of it. Even though it’s a minimum application, it’s perfectly functional and you could chat with others all day long with this little app. Just remember this sequence when coding chat applications:
Change value of shared object property attribute (e.g., text content)
Change local properties with shared object value within the function
When you look at client-side shared objects as a simple sequence, it’s not so hard to see how they are set up in a script.