Groups | Blog | Home
all groups > macromedia flash flash remoting > october 2004 >

macromedia flash flash remoting : Multiple service calls not working


bluestix
10/15/2004 3:44:14 PM
I can make calls from Flash to ColdFusion on my server but in the file I am
working on I can only get one call to return information.

If I make any additional calls to the same service or define a new service and
make calls to that they dont work.
They dont return a result or a fault. Nothing. Just blank.

Any thoughts?

Here is my code for the first frame:
import mx.remoting.Service;
import mx.remoting.Connection;
import mx.remoting.RecordSet;
import mx.rpc.ResultEvent;
import mx.remoting.PendingCall;
import mx.rpc.RelayResponder;
import mx.rpc.FaultEvent;
import mx.remoting.DataGlue;
if (inited == null) {
inited = true;
myservice = new Service("http://localhost:8500/flashservices/gateway", new
Log(), "NVisionApp", null, null);
}
//this call works
var myContracts:PendingCall =
myservice.getClientContracts(_root.CustomerNumber.text);
myContracts.responder = new RelayResponder(this, "getClients_Result",
"getClients_Fault");
function getClients_Result(re:ResultEvent):Void {
ClientBox.columnNames = ["ContractNumber", "ContractStartDate", "FKeyCustID"];
ClientBox.getColumnAt(0).width = 110;
ClientBox.getColumnAt(1).width = 160;
ClientBox.getColumnAt(2).width = 110;
ClientBox.dataProvider = re.result;
}
_global.CustNum = _root.CustomerNumber.text;
var myListener = new Object();
myListener.cellPress = function(event) {
var cell = "("+event.columnIndex+", "+event.itemIndex+")";
trace("The cell at "+cell+" has been clicked");
var Index2 = ClientBox.selectedIndex;
trace("The selected index is "+Index2);
var Info1 = ClientBox.getItemAt(Index2);
_root.ContractNumber1.text = Info1.ContractNumber;
_global.contractnumber = _root.ContractNumber1.text;
_root.TranForm22.TranForm11.CustNum.text = _root.CustomerNumber.text;
trace("The Contract number is "+contractnumber);
Contract.removeAllColumns();
_root.Edit._visible = true;
_root.New._visible = true;
//This gets the clients transaction totals
//This call does not work
var Transactions:PendingCall =
myservice.getTransactions(_global.contractnumber);
Transactions.responder = new RelayResponder(this,
"getTransactionTotals_Result", "getTransactionTotals_Fault");

function getTransactionTotals_Result(result:ResultEvent):Void {
trace(result.result);
_root.Purchased.text = result.result[0];
_root.Used.text = result.result[1];
_root.Remaining.text = result.result[2];
}

function getTransactionTotals_Fault(fault:FaultEvent):Void {
// notify the user of the problem
//
mx.remoting.debug.NetDebug.trace({level:"None", message:"There was a
problem: "+fault.fault.faultstring});
}
};
ClientBox.addEventListener("cellPress", myListener);
Keith Dodd
10/21/2004 1:30:27 PM
Not sure if my situation is the same; but I wrestled for a day with what might
be same problem as you're having. My first call (in an init function) worked
fine. But, when I used same service with another method call (or even the same
method as the init one!), I couldn't get it to go to the responder function.
Interestingly, in the NetDebugger it showed that proper ColdFusion call was
made and I was getting data! Just couldn't get it to move to the function.)

I then changed the "this" in the relayResponder (in the second and other calls
after the init) to "_root" and it WORKED!

I was just getting to post a question as to WHY this behavior, when I saw your
post. Please let me know whether this situaition is the same and whether what I
found works. If so, I'll post something asking the Why question. (I think my
email is in my profile, if you want to email me.)

Hope this helps.

Keith
AddThis Social Bookmark Button