macromedia flash flash remoting:
hi,
I am trying to develop an application in which I am attempting to implement MVC programming with Forms, but I have yet to be able to get it to work the right way with FLash remoting.
I created a custom class for my data model which should be able to handle all the data manipulation for the application, here is an example:
ActionScript:
class dataModel {
// declare all application variables
// declare recordset objects
private var getDeptRES:Object;
// declare public variables
var activeScreen:String;
var departments:RecordSet;
// class constructor method
function dataModel() {
// declare department objects
getDeptRES = new Object();
// declare data tracking variables
departments = new RecordSet();
}
function getDepts():RecordSet {
var depts:RecordSet;
_root.srv.getProducts(getDeptRES);
getDeptRES.onResult = function(result:Object):Void {
for(var i:Number=0; i < result.getLength(); i++) {
depts.addItem(result.getItemAt(i));
}
}
return depts;
}
}
after defining my class I create my presenter which is the main form of the application. Within this form, (which is basically the same as the mx.screens.Form except its been extended to handle the flow of screen transitions better within my app), I create an instance of my class:
ActionScript:
admin = new dataModel();
I also have the flash remoting set up in the FLA because that seems to be the only way people have been able to get it to work. This is why when I'm calling up the flash remoting service I set it up at _root.srv.
now the problem I'm having is when the data is to be returned from flash remoting. The repsonder object I created (getDeptRES) seems to be ignored. I recieve:
quote:
--------------------------------------------------------------------------------
NetServices warning 3: There is no defaultResponder, but no responder was given in call to getDepartments
--------------------------------------------------------------------------------
eventhough clearly I have a responder object in my code. Because of this, I cant seem to get the data into my model.
I then get:
quote:
--------------------------------------------------------------------------------
NetServices info 1: getDepartments_Result was received from server: [object Object]
--------------------------------------------------------------------------------
but I cant access or see when I debug where exactly that is going.
And the fact that it seems to be a timing issue when pulling data from remoting.
any suggestions?
chuck