Copy link to clipboard
Copied
Hi all,
I want to find a way to use an API.LMSCommit('') call to let my modules check to see that they are still connected to the LMS.
If it is a false boolean then it calls myAlert function to pop up a message to tell the learner they need to reconnect.
Is this the right way to do this? or is there a way to do this already in Captivate 8?
var checked = API.LMSCommit()
if (checked == true){
//do nothing;}
if(checked == false){
import flash.external.ExternalInterface;
ExternalInterface.call("myAlert");
}
Cheers
Luke
Copy link to clipboard
Copied
Further to the above,
I did find a function in the scormdriver.js that comes with 8 and I figured that already has a call to commit.
So I am trying this in AS3
import flash.external.ExternalInterface;
var checked = ExternalInterface.call.("SCORM_CallLMSCommit")
if(checked == "SCORM_FALSE"){
ExternalInterface.call("myAlert");
}
Copy link to clipboard
Copied
First question, even if you alert that is not connected, how is the learner going to reconnect?
The SCORM_CallLMSCommit will actually return "false" as that is the default value of SCORM_FALSE. Plus the function returns either true or false as a Boolean.
So you could just say:
import flash.external.ExternalInterface;
var checked:Boolean = ExternalInterface.call.("SCORM_CallLMSCommit")
if( !checked ){
ExternalInterface.call("myAlert");
}
Copy link to clipboard
Copied
Thanks TLC,
I have added a function that changes the users browser and throws up a warning (blinking) to tell the learner that they need to log in again to complete the learning.
Thanks for the above code, I'll try it out and see what happens
Luke
Copy link to clipboard
Copied
I have tried this with some tracking components either side
var checked:Boolean = ExternalInterface.call.("SCORM_CallLMSCommit")
Unfortunately it looks as though this call is breaking. Either I'm not calling the right function in the scormdrive.js or the LMS is not responding to the call.
Copy link to clipboard
Copied
I believe the ExternalInterface.call is not getting any further than the captivate stage. As that is where I have myAlert in JavaScript. Is there a way to get the call beyond the player something like parent.parent.? I have tried that btw and it just shows up as an ActionScript error.
Before you ask I am trying to make this moduler like a widget for non programmers in our team to drag and drop on to their captivate stage.
Cheers.
Copy link to clipboard
Copied
The function should be there. The actual scorm spirit could be in the parent.
Not on a computer right now, but you could actually just check the value of the spirit variable. Look for a function like getApi or something like that. The result is put into a variable. The value of the variable should be API for scorm 1.2
Copy link to clipboard
Copied
If I didn't know you were a great programmer I would have said you were a poet "The actual scorm spirit " Indeed! but I think I get the gist. I will look into it in the morning.
Thanks TLC.
Copy link to clipboard
Copied
The variable is SCORM_objAPI, which should have a value of API.
The function to get the API is SCORM_GrabAPI();
Copy link to clipboard
Copied
OK so I am now trying this in JavaScript back in Cptv8 inside a "Time Based Action Widget"
API = SCORM_GrabAPI();
if(API == null){
cpAPIInterface.setVariableValue("SCO_NO",1);
myAlert();
}
So far no result out of localhost I will try:
API = SCORM_GrabAPI();
if(API != null){
cpAPIInterface.setVariableValue("SCO_NO",1);
myAlert();
}
After loading this to scormcloud.
Copy link to clipboard
Copied
So far so good, It would seem that on an LMS the SCORM_GrabAPI(); is finding the API and returning an not null. But I don't know if that is just it finding the function.
Copy link to clipboard
Copied
So overnight I will try this and see what I get in the morning.
myVar = setInterval(APIChecker,60000);
APIChecker();
function APIChecker(){
API = SCORM_GrabAPI();
if(API != null){
myAlert_happy();
}
else {
myAlert();
}
}
myAlert_happy makes the browser window a greenish color
myAlert makes it a red.
Copy link to clipboard
Copied
Curious, the SCORM_GrabAPI(); function returns a value of [object Object].
What does that mean?
Copy link to clipboard
Copied
So with that I'll try this:
myVar = setInterval(APIChecker,1200000);
APIChecker();
function APIChecker(){
API = SCORM_GrabAPI();
if(API == "[object Object]"){
myAlert_happy();
cpAPIInterface.setVariableValue("SCO_NO",API);
}
else {
myAlert();
}
}
Copy link to clipboard
Copied
So this next, based on what I found in the scormdriver.js
var myVar = setInterval(APIChecker,1200000);
APIChecker();
function APIChecker(){
API = SCORM_GrabAPI();
if (API.LMSCommit()!=null)
{
myAlert_happy();
cpAPIInterface.setVariableValue("FOO","back at ya");
}
else {
myAlert();
cpAPIInterface.setVariableValue("FOO","Lost connection");
}
}
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more