amerywu
05-16-2005, 12:58 AM
I have a question you may be able to help answer.
I have a java class, RithUser
it contains another class RithStatus as a member
I have the same structure in Flash.
I know that Openamf returns RithStatus as a member of RithUser on the server but it remains undefined in onResult method. Tried all sorts of stuff, but nothing seems to work.
function onResult(resultObj:ResultEvent):Void {
trace("INFO LoginCommand::onResultOperation - Using view: "+viewRef);
// The resultSet is an array but we cannot declare its datatype here
// because we cannot cast it to Array() due the clash with the
// Array() global function in Flash (bug/incompatibility with AS1.)
//
// To see this for yourself, uncomment the following line:
// trace (resultObj.result instanceof Array);
var resultSet = resultObj.result;
try {
if (resultSet.length>1) {
viewRef.status_txt.text = "There can't be two of you, but there is";
return;
}
for (var i = 0; i<resultSet.length; i++) {
var n = resultSet[i];
var un = n["userName"].toString();
var uid:Number = n["uid"];
var pos:Number = n["position"];
var pword:String = n["pword"];
var rithstat:Object=new Object();
rithstat = n["rithStatus"];
trace(rithstat); // returns undefined
trace(n["rithStatus"]);// returns undefined
trace(n["rithStatus"].age);// returns undefined
var currentStatus:RithStatus = new RithStatus();
currentStatus.setUid(rithstat["uid"]);
currentStatus.setAge(rithstat["age"]);
currentStatus.setTimestable(rithstat["timestable"]);
currentStatus.setAttempts(rithstat["attempts"]);
currentStatus.setRatio1(rithstat["ratio1"]);
currentStatus.setRatio2(rithstat["ratio2"]);
currentStatus.setRatio3(rithstat["ratio3"]);
currentStatus.setLastUseDate(rithstat["lastUseDate"]);
trace ("age="+currentStatus.getAge());
//////////////////////////////////////////////////
var user:RithUser = new RithUser();
user.setUid(uid);
user.setUserName(un);
user.setPosition(pos);
user.setPword(pword);
user.setRithStatus(currentStatus);
trace(un+" "+uid);
if (uid>0) {
viewRef.loginSuccessful(user);
}
}
} catch (errorObj:Error) {
viewRef.status_txt.text = errorObj.message;
}
trace("INFO LoginCommand::onResultOperation - Got a result!!!!!!!!!!!!: ");
//viewRef.newPersonList( resultSet );
}
Any tips ?
I have a java class, RithUser
it contains another class RithStatus as a member
I have the same structure in Flash.
I know that Openamf returns RithStatus as a member of RithUser on the server but it remains undefined in onResult method. Tried all sorts of stuff, but nothing seems to work.
function onResult(resultObj:ResultEvent):Void {
trace("INFO LoginCommand::onResultOperation - Using view: "+viewRef);
// The resultSet is an array but we cannot declare its datatype here
// because we cannot cast it to Array() due the clash with the
// Array() global function in Flash (bug/incompatibility with AS1.)
//
// To see this for yourself, uncomment the following line:
// trace (resultObj.result instanceof Array);
var resultSet = resultObj.result;
try {
if (resultSet.length>1) {
viewRef.status_txt.text = "There can't be two of you, but there is";
return;
}
for (var i = 0; i<resultSet.length; i++) {
var n = resultSet[i];
var un = n["userName"].toString();
var uid:Number = n["uid"];
var pos:Number = n["position"];
var pword:String = n["pword"];
var rithstat:Object=new Object();
rithstat = n["rithStatus"];
trace(rithstat); // returns undefined
trace(n["rithStatus"]);// returns undefined
trace(n["rithStatus"].age);// returns undefined
var currentStatus:RithStatus = new RithStatus();
currentStatus.setUid(rithstat["uid"]);
currentStatus.setAge(rithstat["age"]);
currentStatus.setTimestable(rithstat["timestable"]);
currentStatus.setAttempts(rithstat["attempts"]);
currentStatus.setRatio1(rithstat["ratio1"]);
currentStatus.setRatio2(rithstat["ratio2"]);
currentStatus.setRatio3(rithstat["ratio3"]);
currentStatus.setLastUseDate(rithstat["lastUseDate"]);
trace ("age="+currentStatus.getAge());
//////////////////////////////////////////////////
var user:RithUser = new RithUser();
user.setUid(uid);
user.setUserName(un);
user.setPosition(pos);
user.setPword(pword);
user.setRithStatus(currentStatus);
trace(un+" "+uid);
if (uid>0) {
viewRef.loginSuccessful(user);
}
}
} catch (errorObj:Error) {
viewRef.status_txt.text = errorObj.message;
}
trace("INFO LoginCommand::onResultOperation - Got a result!!!!!!!!!!!!: ");
//viewRef.newPersonList( resultSet );
}
Any tips ?