Nonpersistent Client-Side Remote Shared Objects - Minimalist Project for Shared Movie Clip (Page 4 of 4 )
The first minimalist project uses a movie clip as a shared object. This one shows how to set up and move a pointer. In creating applications that have online slide shows that work something like a PowerPoint presentation, you need all of the viewers to see the pointer move to the location on the screen where you want the audience to focus. Using a hitchhiker thumb as a pointer, this application has numbers in each of the stage’s four corners. The four numbers are just positions on the stage so that you can see that when you move the pointer on the screen, it will go to the same positions on all of the screens connected to the application. You’ll use these classes and objects for the application:
Objects Movie Clip (1)
The following steps will walk you through the project:
Open a new Flash document and set up the following layers, from top to bottom: Actions, MC, and Background.
In the Background layer, place a number from 1 to 4 using a 48 point font in each of the four corners of the state as shown in Figure4-2. Lock the layer.
Select the shape and press F8 to open the Convert to Symbol dialog box. Select Movie Clip and click OK. Select the movie clip on the stage and provide it with the instance namepointer_mcin the Properties panel. Lock the layer.
Figure 4-2.Completed stage
Click on the first frame of the Actions layer and type in the following script in the Actions Panel:
If it does not exist already from the previous example, in the server-side FMS2 root, create a new folder and name it zbasicSO.
Once you have completed the application, publish it (File > Publish). When you test it, you have to open a second window with the same application so that you can see two instances running at the same time. You will see that when you move the pointer on one screen, it also moves on the other.
Note: If you are connecting to an FMS2 server via the Internet, it’s best to upload the files to a web server to avoid running into security issues while testing.
In looking at the code, you will see that the value of the shared object is based on changes in the position of the mouse pointer. Whenever the mouse moves, both the _x and _y values of the mouse position are passed to the shared object data attributes as well as the pointer. Whenever the shared object values change, they trigger theonSyncevent handler that updates the shared object values on all of the connected clients.
Please check back next week for the conclusion to this article.
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.