PDA

View Full Version : Flash Remoting Promlems


MarioV
12-15-2003, 05:57 PM
I've trying to figure out why this doesn't work.

I'm using Flash MX 2004 Pro, Flash MX 2004 Components, ColdFusion 6.1. I can't get the lists to poulate with the results from a query in the CFC.

Here's the URL of the same code in action:
http://www.mariovasquez.com/prisontattooart/index2.cfm


Here's the code:

#include "NetServices.as"
#include "NetDebug.as"

if (isGateWayOpen == null) {
initialized = true;
NetServices.setDefaultGatewayUrl("http://localhost:8500/flashservices/gateway");
var my_conn = NetServices.createGatewayConnection();
// Create the service objects
var UIService = my_conn.getService("tattooSite.cfc.tattooInitApp", this);
}


function getCats_Result(result) {
trace(result);
ComboBoxFill(searchList, result.BOOKS,"--Choose a book--");
}

function getCats_Status(status) {
errorHandler(status.description);
}

// Major error handler, usually a connection is bad, so the movie will fail
_global.System.onStatus = function(error) {
errorHandler("There was a connection failure");
}

// General error handler for entire movie
function errorHandler(message){
trace(message);
};


// FILL THE LIST
function ComboBoxFill(cbName, rs, zeroElement){
var fields = rs.getColumnNames();
// if there is a descriptive text to put in the Combo box
// put it in the 0 position of the RecordSet
if(zeroElement != null) {
var temp = {};
rs.addItemAt(0, temp);
rs.setField(0,fields[0], 0);
rs.setField(0,fields[1],zeroElement);
}
trace(rs.getLength());
var idField = "";
var descField = "";
for(var i=0; i<rs.getLength(); i++) {
descField = rs.getItemAt(i)[fields[1]];
idField = rs.getItemAt(i)[fields[0]];
cbName.addItem({label:descField,data:idField});
}
}

// Call the remote service to populate the combo boxes
UIService.getCats();


Any ideas?

Thanks!