We’re using flash for some of our (proprietary, non-SCORM/AICC) elearning courses, and using ExternalInterface to make the handshake from Flash -> JavaScript (which in turn talks (asynchronously?) to .NET/DB).
one such useful function, setScore, is in charge of passing a learner’s score from Flash to Javascript but only if the user does not have a completed status. Thus we check the learners’ status (requiring a response via ExternalInterface) and only communicate a new score to the server if they haven’t already submitted one.
public function getStatus():String{
//Gets the status of the current LMS course page.
var stat=ExternalInterface.call("API.LMSGetValue","status")
return stat.toString();
}
public function setScore(numPts:Number, overwriteExisting:Boolean):Void{
if (getStatus() != "completed" || overwriteExisting == true){
//haven't seen this yet
trace("setScore:"+numPts);
var ptsString:String=numPts.toString();
ExternalInterface.call("API.LMSSetValue","score", ptsString);
}else{
//already saved a score
trace("score already exists for this page");
}
}
My question is whether getStatus’ resulting (asynchronous?) JS call to the server could hit lag which trips the else clause of setScore. It definitely works flawlessly here but now our client is having issues in which scores aren’t hitting the server consistently when accessed from his location.
Is there some sort of success handler model we’re supposed to be using instead of just sliding the variable in as if it’s all within actionscript’s umbrella? I can’t find much of anything regarding externalInterface vs. asynchronous calls to server or how to deal with this scenario.
To put it another way, is there any way flash can progress past a “return ExternalInterface.call(…)” statement without getting the value returned?
Thanks!
-matt
PS sorry if there’s already a post here about it… when I ran a forum search for ExternalInterface, it said there were no results and that the term ExternalInterface was too long to search for (???)