Groups | Blog | Home
all groups > coldfusion flash integration > april 2007 >

coldfusion flash integration : Query CF Database from Flash MX Pro


lars NO[at]SPAM work
4/4/2007 6:18:03 PM
Could someone share an example, or point to a tutorial, of how to query a
ColdFusion MX 6.1 DB from inside Flash MX Pro. I know how to pass an external
variable to Flash, but don't know how to then take that variable (probably a
record ID such as 1 or 6, etc.) and then query a ColdFusion DB to get the
contents of the fields that match that record ID. An exact script example
would be much appreciated.
Sojovi
4/4/2007 10:40:10 PM
var result_lv:LoadVars = new LoadVars();
result_lv.onLoad = function(success:Boolean) {
if (success) {
result_ta.text = result_lv.ID;
} else {
result_ta.text = "Error connecting to server.";
}
};
var send_lv:LoadVars = new LoadVars();
send_lv.recordID= ID;
send_lv.sendAndLoad("yourpage.cfm", result_lv, "POST");

This is an example modified from Flash AS help. Take it as a guide, but if
it's not enough, I'll try to POST a more detailed example.

REgards
The ScareCrow
4/4/2007 11:26:38 PM
Sojovi
4/4/2007 11:53:12 PM
lars NO[at]SPAM work
4/5/2007 2:18:30 PM
Thanks Sojovi and Ken for your comments.

Yes a more detailed example would be appreciated. Although I do program in
ColdFusion, I am quite limited in my Flash ActionScript knowledge. What I am
wanting to do is to pass a record ID to Flash and then query a CF MX 6.1
dtabase that is on the same server as where the Flash will reside (i.e.
ColdFusion functions on the same server that the Flash will be on). After the
query, then want to take the contents of two fields of the record that matched
the passed record ID, and display one field in Flash as the text for a button
link, and use the other field as the ColdFusion page name to jump to when that
text button is clicked on.

I have worked out the process where I query the DB in ColdFusion code on the
page that holds the Flash, and then pass the text into Flash as two variables:
var title = _root.title;
var xpage = _root.ID;

The title varible is displayed as the text of a button, and the xpage variable
is process as follows:

on (press) {
}
on (release) {
getURL(xpage+".cfm", "_top");
}

It just seems that it would be better to pass only the record ID, then do a
ColdFusion DB query from within Flash, and process the two fields as shown
above. I just am unsure how to do that query and set those two variables
within Flash.

Thanks for any help in this regard.


AddThis Social Bookmark Button