Add Comment
Simple RemoteObject Tutorial
ColdFusion Tutorial #1
This is a simple tutorial showing how to communicate between Flex & ColdFusion. The tutorial makes a simple call to a CFC and returns the current time.
Demo.mxml
Lines 6 - 10 simply import the ResultEvent and define an event handler for our remote connection. Line 9 does the work, setting the label text to the remote object result.Lines 14-16 setup the remote object. This tutorials like all tutorials on this site, use a ColdFusion mapping called flexcf to get access to the ColdFusion CFC's. So flexcf.1.DemoCFC is a pointer to the Demo.CFC in a directory called 1. The flexcf mapping points the the tutorial base directory D:\FlexCF\tutorials\ for example. We define the function for handling a successful call on line 15.
Line 18 just sets up an empty label field to display the result in
Line 19 creates a button that calls the remote object method getServerTime(). getServerTime is a method in the CFC.
DemoCFC.cfc
This is very simple. It is important to remember that the CFC methods need to have access set to "remote".This just returns a string, which is the result of now(). The current server time.
Demo
See this code running!
Download
Download this code as a zip!
Comments
There are no comments!Click button to add a comment
Author
Dale Fraser