PDA

View Full Version : Flash Remoting/CFC gateway connection trouble.


Dechirico0
06-06-2004, 02:21 AM
I have created 3 flash files: main.swf, one.swf, and two.swf. Both one and two connect to different cfc's using flash remoting. When accessing the swf's directly they both work fine. Main.swf is the container and I load one.swf and two.swf as separate pages into main.swf using the loader component. This is where the problem arises. The child swf's load fine, but only the first swf accessed connects with flash remoting, the other (accessed 2nd) does not return data. I checked the Netconnection Debugger and it registers a connection but then seems to stall. I am using Flash MX 2004 Professional. Both child swf's have the following code:

#include "NetDebug.as"
#include "NetServices.as"
#include "DataGlue.as"
// Connect to the gateway and create a service object

function ListBoxResponder(lbName) {
this.lbName = lbName;
}
ListBoxResponder.prototype.onResult = function(result_rs) {
DataGlue.bindFormatFunction(this.lbName, result_rs, formatTheData);
};
ListBoxResponder.prototype.onStatus = function(error) {
trace(error.description);
};
function formatTheData(record) {
label = record.item1;
sTemp = {};
sTemp.item1 = record.item1;
sTemp.litem2 = record.item2;
sTemp.item3 = record.item3;
return {label:label, data:sTemp};
}

if (connected == null) {
connected = true;
NetServices.setDefaultGatewayUrl("http://127.0.0.1flashservices/gateway");
var my_conn = NetServices.createGatewayConnection();
my_conn.onStatus = errorHandler;
var myService = my_conn.getService("cfcName");
myService.cfcFunction();
}

myservice.serviceFunction(new ListBoxResponder(solutions_lb));
solutions_lb.addEventListener("change", sUpdateDisplay);
function sUpdateDisplay(lbs) {
var lbs = lbs.target;
var record = lbs.selectedItem.data;
item1_txt.text = record.item1;
item2_txt.text = record.item2;
item3_txt.text = record.item3;
};


Any help would be greatly appreciated.

Thx.

Dechirico0