PDA

View Full Version : php,mysql how to access data and issue loadmovie command


zerointeger
11-12-2007, 11:10 PM
Does anyone here know how to deal with the sendandload function? I am having some problems that I am not sure how to resolve.

I am using a data grid to provide information which I can use to query a mysql database for a file path. This is working but I am not sure how to access the received data. here is a sample of the return code I am working with:
year=2008&description=XL1200C&model=Sportster&onLoad=%5Btype%20Function%5D
image0=%2E%2E%2Fimages%2Fbikes%2Fimages%2Fxl1200c% 5Fangle%5F08%2Ejpg

As you can see, the 'image0=' variable contains the path to my image. I am going to use this string to then send to a loadmovie function.

Here is my flash action script.
// listen and loadmovie for row clicks
var cellListener = new Object();
cellListener.change = function(event) {
bikeimg_lv.model = event.target.selectedItem.model;
bikeimg_lv.description = event.target.selectedItem.description;
bikeimg_lv.year = event.target.selectedItem.year;
trace(bikeimg_lv);
bikeimg_lv.sendAndLoad(filepath + "flash_query.php", bikeimg_lv, "GET");
};
// process query
bikeimg_lv.onLoad = function(ok:Boolean) {
if (ok) {
if (this.errorcode=="0") {
trace(bikeimg_lv);
msg_ta.text = "Listed above are the detailed records for the " + bikeimg_lv.model + " " + bikeimg_lv.description + " ";
} else {
// show kind of error
msg_ta.text = errorMsgs[Number(this.errorcode)];
// if query error, show mysql_error
if (this.errorcode == "3") msg_ta.text += ": " + this.msg;
}
} else {
// if loadvars failed (eg, if script not found)
msg_ta.text = "Failed to retrieve image for bike.";
}
}
bikes_dg.addEventListener("change", cellListener);
msg_ta.text = "Retreiving image for bike...";