Accessibility
 
Home / Developer Center / Flash Communication Server Developer Center /

Flash Communication Server Article

Icon or Spacer Icon or Spacer Icon or Spacer
Giacomo Guilizzoni
 
Giacomo Guilizzoni
QA Engineer
Macromedia
 

Making components for Macromedia Flash Communication Server MX


I think components are the coolest. You build them once, and you can use them many times or even send them to your friends. Using components you can build Rich Internet Applications in no time.

The only problem with components is that they're a little hard to create. You need to know ActionScript pretty well to create sophisticated components that suit your needs. There are some really good tutorials on how to build components available, but they don't address the issues related to building a Macromedia Flash Communication Server MX component.

 
In this article we're going to build a component from scratch. To follow the step-by-step process you will need to be familiar with Macromedia Flash MX, ActionScript and the basic concepts of the Macromedia Flash Communication Server MX (such as NetConnections, Shared Objects, ActionScript for communications, etc.). To learn more about these topics, please refer to the documentation that is included with Macromedia Flash MX and the Macromedia Flash Communication Server MX.
 

Instant Poll component
In this tutorial we are going to build an "Instant Poll" component. Here's the final result in action (select your favorite fruit).

 

This sample file requires the latest version of the Macromedia Flash Player.

Download it now.
 
Try opening it in two more browser windows and vote in each one. Pretty neat, huh?
 
Sample files
Before you begin, download the source files for this tutorial.
Windows   Macintosh
Download the sample file Instant_Poll.zip (103K)   Download the sample file Instant_Poll.sit (86K)
 
As you probably already know, Macromedia Flash Communication Server MX components have a client-side and a server-side part—that work together to make the magic happen. The client-side part is a Macromedia Flash MX movie, named Instant Poll.fla.
 

Copy Instant Poll.fla into this location:

C:\Program Files\Macromedia\Flash MX\First Run\Components folder

Quit and then relaunch Macromedia Flash MX and you'll see an "Instant Poll" panel appear in your components window (Window > Components).

 
The server-side part is an ActionScript for Communication text file, named instantpoll.asc.
 

Copy instantpoll.asc into this location:

flashcom\scriptlib\components\ folder

This folder exists on the machine where you installed the Macromedia Flash Communication Server MX.

Note: if you can't find the components folder inside the scriptlib folder, do a search for "scriptlib" on the hard disk.

 
The third file in the sample files folder is named preview.fla. Hold onto that file for now. We'll use it later when we create a live preview movie for the component.
 
This tutorial covers the following topics:
·
Using the Instant Poll Component in your Rich Internet Applications
·
Outlining the process for creating components
·
Coding the component: server-side part
·
Coding the component: client-side part
·
Understanding Graph Objects
·
Creating the live preview movie
·
Using best practices: tips and tricks
 
 
 

About the author
Giacomo 'Peldi' Guilizzoni (a.k.a. peldi.com), has been programming for more than half of his life (since age 12), and just can't get enough. He gets excited about every aspect of computer science, from assembly languages to graphic design, from the inner workings of compilers to new-media art. Raised in the fertile grounds of Bologna, Italy, he fell in love with Macromedia products while doing an exchange program at UC San Diego. A long-time ultimate player, he created and maintains Ultilinks to share his passion about the sport.