EasyCFM.COM ColdFusion Forums / Flash Development / falsh website

   Reply to Discussion | New Discussion << previous  
Posted By Discussion Topic: falsh website

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

stinasius
05-06-2007 @ 4:30 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Junior Member
Posts: 109
Joined: Jan 2007

how do i design a fully functional website in flash 8 and also use coldfusion as a backend for database manupilation.

kicker
05-06-2007 @ 6:40 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
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


Website Designed and Developed by Pablo Varando.