Hello, all!
I'm using Flash remoting with CFML. In my FlashMX2004 app, I have successfully
created a connection and a Service Object. My RESULT function creates a
RecordSet Object, get's the data, loads each table row into a custom class that
I made (called Building), and then puts those (Building)objects into an array.
For some reason, I can trace the value of any parameter within my array of
objects as long as I am in the RESULT function, but outside of that, I keep
getting UNDEFINED results. Can anyone help?
Here is the script:
//create new array
var myBuildingList:Array = new Array();
// connect to service (CFM) and create Service Object
var getBuildingQuery:Service = new
Service("http://blah-blah-blah/flashservices/gateway",new
Log(Log.DEBUG),"folder.anotherfolder",null,null);
// call the service buildingList() method
var pc:PendingCall = getBuildingQuery.buildingList();
// tell the service what methods handle result and fault conditions
pc.responder = new RelayResponder(this, "buildingList_Result",
"buildingList_Fault");
//result function
function buildingList_Result(result:ResultEvent){
//create a RecordSet from the Service query
var buildings_rs:RecordSet = RecordSet(result.result);
//loop through record set - this will populate the array with Building
Objects (custom class from Building.as)
for(i=0;i < buildings_rs.getLength(); i++){
//record set into temp variable j
var j = buildings_rs.getItemAt(i);
// create Building Object from Service Query row into temp variable k
var k:Building = new Building(j.BUILDINGNAME, j.ADDRESS, j.PHONE, j.PARKING,
j.PUBLICTRANSPORTATION, j.PHOTO, j.XLOC, j.YLOC);
//populate myBuildingList Array with Building Objects
myBuildingList = k;
}
}
So, like I was saying, if I trace(myBuildingList.length) INSIDE the
buildingList_Result function, I get a return. If I trace(myBuildingList.length)
at the root (where I created the array to begin with) I get a return of 0.
Can anyone tell me why?
teknon - 28 Jul 2005 16:17 GMT
so! Further developments!
It seems that when I test the movie, If I back up a frame and then play, the array is there?!?!? Is there something I should know about the order of operations?