I've put together a collection of Flash Remoting examples that I hope will illustrate some of the potential of Rich Internet Applications (RIAs) in how they can be used to replace standard HTML forms.
All examples use standard Flash UI components that are freely available with Macromedia Flash MX.
They can be downloaded from the Daemon site by following this link.
A full description of what's included follows:
Combo boxes populating combo boxes example
Two combo boxes (HTML select controls) that are part of the Flash UI Components set, the first is populated by Flash Remoting as the Flash movie loads.
Making a selection from the first calls the CFC on ColdFusion MX again, passing a parameter via Flash Remoting to use as a filter in a query, this then populates the second combo box.
We're often asked in our ColdFusion courses how this might be done in HTML, it can easily be achieved via Flash Remoting with a small amount of code.
Combo boxes, completed form example
Two combo boxes, like in the previous example one populating the other dynamically again.
In this example making a selection from the second Combo box calls the same CFC on ColdFusion MX so that we can retrieve the details of a specific record.
The example is presented as an employee record look up.
Combo Box & List Box component example
The ActionScript for this was adapted from the two Combo boxes example while answering a question posted on the FlashKit Flash MX forum.
The example works the same way as the other example, only the List box is populated first by Flash Remoting.
Tree component example
In this example data from the same CFC is presented in the standard Tree component that is part of Flash UI Components Set 2.
The nodes are added to the tree as it loads with data received from an initial call sent via Flash Remoting to the CFC on ColdFusion MX.
Expanding a node calls the CFC via Flash Remoting once more, populating the Tree it once the values are received.
This makes use of a "loading..." prompt displayed within the Tree node while it waits for data. Once populated the node is effectively cached.
Tree Component, completed form example
The exact same Tree component and sample code as the previous example, the code has been enhanced to demonstrate it's use within a form.
Choosing a child from one of the nodes calls the CFC again, retrieving the details for the selected record.
List swap interface
This is an extra that I thought that I'd throw in because it emulates a useful form functionality, built using two standard List boxes from the Flash UI Components set.
At load the Flash movie has two List boxes side by side with the left List box being populated by Flash Remoting at start.
Buttons across the bottom of these two List boxes allow the user to swap items between lists, ActionScript sorts the lists after the swap has occurred.
You have the ability to move individual items or all currently within a list.
Posted by at 06:09 PM | Permalink