Moderator
Posts: 717
Joined: Oct 2004
|
For flash to work with coldfusion you need to create cfcs that hold the functions that do the database calling. Usually a simple query. Once you have your cfcs and functions set up test to make sure that the cfc is good by calling it in the web browser of choice and add "?wsdl" to the end. So something like this: http://localhost:8500/mysite/cfc/my_cfc.cfc?wsdl Then in flash you will need to import the services required to make a connection and then call the connection as illustrated below.
import mx.services.WebService; import mx.services.PendingCall; import mx.services.Log; function PopulateLists() { var myService = new WebService( "http://localhost:8500mysite/cfc/startContent.cfc?wsdl"); var serviceCall:PendingCall = myService.myFunction(); serviceCall.onResult = function(result) { if (result == "error in processing") { trace(result); } else { mGrid.dataProvider = result; } }; } PopulateLists();
This will call a cfc function with the name of myFunction and get the results from the query to return to a Grid in the flash app. You can also pass varaibles to the cfc (cfarguments) by doing this in your code:
var serviceCall:PendingCall = myService.myFunction(variable1,variable2,etc);
You can populate lists, text fields, grids, images, etc by doing this. It's very simple and straight forward.
Craig Clearcg.com
|