|Tech Jobs | Forum | Articles|
Scripting Collaborative Applications with Flash Communication Server MX
The right approach, I concluded, was to clone the Chat component and add a ClearHistory button to it. Since I'm a complete Flash novice, I admit I fumbled around quite a bit trying to figure out how. Thanks to some helpful guidance from Mike Chambers I muddled through. (It helps if you unlock the widgets you're trying to edit!) Once I opened up the Chat component, I saw that it already had the needed function, along with a namespace prefix:
All I had to do was add a ClearHistory button to the Chat component, and
name its click handler
The next idea was to add a label called
On the client side, in the Chat component's
The first client to call
In the server-side Chat component's constructor, I connected it to the
Then, in the server-side Chat component's
This code unpacks the username from the per-client data managed by the
server, and passes it to the
Synchronized Persistent Objects
The PeopleList component is built using a transient shared object. That's appropriate for a real-time presence indicator, but suppose you also want to log and count the users of your chat application. Exploring this idea gave me a chance to try out persistent shared objects. I started by dragging a ListBox--an ordinary Flash UI component, not a special Communication Component--onto the Chat stage.
Here's the client-side code to create a persistent shared object in which to remember all the users who have signed in.
On the server, as before, I mirrored this connection in the Chat constructor:
In the server's
All clients connected to this shared object automatically receive a synchronization message when its data changes. Back on the client side, here's the handler I wrote for that synch message:
The result is a listbox, on each client, that counts visitors and visits like so:
Something Different, Something New
The demo applications included with FlashComm do a good job of sketching further possibilities. I particularly like the presentation example. A speaker sends an AV stream to an audience, along with a slide show (which is itself an embedded Flash movie). As the speaker advances through the slides, the audience stations are, by default, synched. However, they can optionally decouple and view slides independently. Audience members can ask questions using chat, or by sending an AV stream to the speaker. It doesn't take much imagination to spin out lots of useful variations on this theme.
Flash MX and the FlashComm server together deliver event-driven peer networking, streaming-media services, a productive scripting environment that targets networked teams of people, and powerful components that embody the essential tools of collaboration. We've seen all these ingredients before, but Macromedia has combined them to create something different and new: a killer framework for the rapid development of collaborative software.
Jon Udell is an author, information architect, software developer, and new media innovator.
Return to Web Services DevCenter
Copyright © 2000-2006 OReilly Media, Inc. All Rights Reserved.
All trademarks and registered trademarks appearing on the O'Reilly Network are the property of their respective owners.
For problems or assistance with this site, email