Skip to main content
Inspiring
May 4, 2006
Answered

Calling a fuction from a response Handler

  • May 4, 2006
  • 2 replies
  • 614 views
I use a function with remote call to populate a grid with data and it works fine.
function getStudentAll() {
<cfoutput> var connection:mx.remoting.Connection = mx.remoting.NetServices.createGatewayConnection( " http://#cgi.HTTP_HOST#/flashservices/gateway/");
var myService:mx.remoting.NetServiceProxy; </cfoutput> var responseHandler1 bject = {};
var approved:mx.controls.DataGrid = studentGrid;
responseHandler1.onResult = function( results: Object ):Void {
approved.dataProvider = results;
}
responseHandler1.onStatus = function( stat: Object ):Void {
alert("Error while calling cfc:" + stat.description);
}
myService = connection.getService("<cfoutput>#Application.comp#</cfoutput>.student", responseHandler1 );
myService.getStudent();
}
Pressing another button I change a value in one column and I need to reload data into the student grid. I've tried to call previous function from the response Handler in the second function but it doesn't work. I don't know why. The call doesn't even enter the getStudentAll function.

function acceptStudent() {
var studId = studentGrid.selectedItem.studId;
_root.messageStudent.text='';
<cfoutput> var connection:mx.remoting.Connection = mx.remoting.NetServices.createGatewayConnection( " http://#cgi.HTTP_HOST#/flashservices/gateway/");
var myService:mx.remoting.NetServiceProxy; </cfoutput> var responseHandler1 bject = {};
var approved:mx.controls.DataGrid = studentHistory;
responseHandler1.onResult = function( results: Number ):Void {
getStudentAll();
}
responseHandler1.onStatus = function( stat: Object ):Void {
alert("Error while calling cfc:" + stat.description);
}
myService = connection.getService("<cfoutput>#Application.comp#</cfoutput>.student", responseHandler1 );
myService.acceptStudent(studId);
}

Any idea?
Thanks,
b.
This topic has been closed for replies.
Correct answer recursivecodes
try:

_root.getStudentAll();

2 replies

recursivecodesCorrect answer
Participating Frequently
May 4, 2006
try:

_root.getStudentAll();
billdimitAuthor
Inspiring
May 5, 2006
Thanks.
It's solved the problem.
b.
Participating Frequently
May 4, 2006
try:

_root.getStudentAll();