Skip to main content
AttaBoy2
Inspiring
September 28, 2010
Answered

Need to populate textfield from a mssql database using coldfusion

  • September 28, 2010
  • 1 reply
  • 976 views

Can this be done?

This topic has been closed for replies.
Correct answer kglad

Thanks Kglad I'm sure I can use the  var receiveLV:LoadVars=new LoadVars(); and maybe an onClip event instead of an onRelease since there won't be a button.


don't use any code attached to an object.

if you want to send data to your cf script when the frame plays, just remove the onRelease code so sendLV.sendAndLoad() executes.

1 reply

kglad
Community Expert
Community Expert
September 28, 2010

sure.  i've only used coldfusion once so i don't remember much of the syntax but it will work the same as any other server-side script that retrieves database data and passes it to flash.

AttaBoy2
AttaBoy2Author
Inspiring
September 28, 2010

Good, I made a contact forn a little while back that sent to a php file that sent email.  I used AS3 there but I'm sarting to get an idea how I'm going to do this.  POST goes both ways doesn't it?  I've used it before to send data but should I be able to retreve data with POST..... I think so.  I think all i need to do is use POST to get the data from a CF file that connects to the database.

I'm going back to the front now.  If you have any code snippets either in AS2,  CF, or PHP that might help to clairify the process it would be appriciated.

thanks

kglad
Community Expert
Community Expert
September 29, 2010

you should use loadvars to communicate between flash and cf.  it's best to use 2 different lv instances, one to send and one to load data:

var sendLV:LoadVars=new LoadVars();

var receiveLV:LoadVars=new LoadVars();

receiveLV.onData=function(src){

trace(src);

}

somebutton.onRelease=function(){

sendLV.data1=sometextfield.text;

sendLV.data2=someothertextfield.text;

etc

sendLV.sendAndLoad("yourcf.cfm",receiveLV,"POST");

}