macromedia.coldfusion.flash_integration
[Top] [All Lists]

Flash, Coldfusion, and MySql

Subject: Flash, Coldfusion, and MySql
From: "CenturyMan1979" <webforumsuser@xxxxxxxxxxxxxx>
Date: Wed, 14 May 2008 18:52:27 +0000 (UTC)
Newsgroups: macromedia.coldfusion.flash_integration

Alright so what I want to do is this,

 1. Send Variables from flash to coldfusion
 2. Have coldfusion query mysql using variables from flash
 3. Return the data to flash and use it

 So I have a flash set up on the stage with a input text field for me to enter 
in a first name. I also have a submit button used to send the first name to the 
coldfusion script. Then I have to Dynamic text field to display the first_name 
I get back from the database.

 // Setup Query Button
 qButton.addEventListener(MouseEvent.CLICK, runQuery);

 function runQuery(evt:MouseEvent):void {
        tStatus.text = "Start Query Handler";
        var myData:URLRequest = new URLRequest("query.cfm");
        myData.method = URLRequestMethod.POST;
        var variables:URLVariables = new URLVariables();
        variables.userName = qName.text;
        myData.data = variables;
        var loader:URLLoader = new URLLoader();
        loader.dataFormat = URLLoaderDataFormat.VARIABLES;
        loader.addEventListener(Event.COMPLETE, completeHandler);
        loader.load(myData);
        tStatus.text = "End Query Handler";
 }

 function completeHandler(evt:Event):void {
        tStatus.text = "Start Complete Handler";
        rtnName.text = evt.target.data.first_name;
        tStatus.text = "End Complete Handler";
 }



 Then I have my coldfusion script called query.cfm.

 <cfsetting enablecfoutputonly="YES">
 <cfset user="root">
 <cfset pass="pass">
 <cfset dataSrc="testDB">
 <cfset userName = form.userName>

 <cfquery name="qUsers" datasource="#dataSrc#" username="#user#" 
password="#pass#">
   SELECT * FROM users WHERE first_name = "#userName#";
 </cfquery>

 <CFOUTPUT QUERY="qUsers">&first_name=#first_name#</CFOUTPUT>

 Problem is in the flash it never seems to run the completeHandler function and 
I can't figure out if it is an issue in the flash script or the coldfusion 
script. Any help on this would be appreciated greatly.


<Prev in Thread] Current Thread [Next in Thread>
  • Flash, Coldfusion, and MySql, CenturyMan1979 <=