Copy link to clipboard
Copied
I was curious if anyone has any insight on how to read SCORM variables into captivate once a project is published on an LMS. Here is my problem. I would like to use captivate to pull the current user data during runtime from the cmi.learner_name variable, and store the data in a captivate variable, so I can then display the users name (or otherwise use the data).
Does anyone have experience implimenting this? I was considering using javascript to assign the value to a captivate variable, but I am a bit lost as to how to make javascript pass the variable to captivate. As well as when to have this happen, since I am sure there are some initialization issues. I would also like to be able to use captivate to make a simple debugger project to use when working with a new LMS using this same principle. Any suggestions?
I have done this through a combination of JavaScript and Flash. You need JavaScript to get the value from the LMS and then I used a Flash file embedded in Captivate to show / process the value. Once you have the value in Flash you can assign the value to a Captivate User defined variable.
The "issue" with these SCORM things is the difference between SCORM 1.2 and SCORM 2004. For some reason a lot of major LMS' are still using the old SCORM 1.2 standard while some are using the "new" SCORM 2004 st
...Copy link to clipboard
Copied
I have done this through a combination of JavaScript and Flash. You need JavaScript to get the value from the LMS and then I used a Flash file embedded in Captivate to show / process the value. Once you have the value in Flash you can assign the value to a Captivate User defined variable.
The "issue" with these SCORM things is the difference between SCORM 1.2 and SCORM 2004. For some reason a lot of major LMS' are still using the old SCORM 1.2 standard while some are using the "new" SCORM 2004 standard. There are some fundamental changes in these two SCORM versions, so basically you would need to make a SCORM 1.2 file and a SCORM 2004 file.
If you don't know Flash then you could probably (just guessing here) assign the value from your SCORM variable to a Captivate user defined variable through JavaScript, but I have no idea how to do that.
/Michael
Visit my Captivate blog with tips & tricks, tutorials and Widgets.
Copy link to clipboard
Copied
Thanks,
I was pretty sure I would have to use a different script for 1.2 vs 2004. Thanks for confirming. I have also noticed that many LMS deal better with 1.2. The current one we are using is setup for 1.2 for the most part, but the LMS has a web based aggrigator that only uses 2004 content??? Strange.
I was hoping that the javascript to captivate would be possible, since I am not great with Flash. But, I guess I just need to get in there and figure it out. I have Flash CS4 and I know some basics, but it is not my forte. Would this need to be a full blown widget?
Copy link to clipboard
Copied
The main difference between the SCORM calls in 1.2 and 2004 is that the SCORM fields have different names. I can't remember if that applies for learner_name though.
To answer your question - No your wouldn't need a full blown widget to do this. That would be total overkill as the code in Flash is maximum 10 lines.
I'll see if I can dig up some code in Flash to get you started once I get in the office tomorrow.
/Michael
Visit my Captivate blog with tips & tricks, tutorials and Widgets.
Copy link to clipboard
Copied
Alright here is some code.. You probably need to adapt if for your own needs, but this will get you started.
In JavaScript create a function like this:
function returnName(str) {
return doGetValue('cmi.learner_name');
}
In Flash create code like this:
// stop the Flash timeline
this.stop();
// import external interface to handle JavaScript communication
import flash.external.*;
// The name of the JavaScript function to call
var callJS:String = "returnName";
//parameter to send to the JavaScript function. This is not needed now
var msg:String = "test";
// Execute the function call and store the result in the variable returnValue
var returnValue:String = ExternalInterface.call(callJS, msg).toString();
// Put the value into a textfield on the Flash stage
this.return_txt.text = returnValue;
Also create a dynamic text field on the stage with the instance name "return_txt"
That should more or less be it. Let me know if it works out for you.
/Michael
Visit my Captivate blog with tips & tricks, tutorials and Widgets.
Copy link to clipboard
Copied
This is pretty cool. Just have some clarification.. where specifically shall I place these codes below:
In JavaScript create a function like this:
function returnName(str) {
return doGetValue('cmi.learner_name');
}
Thanks.
Copy link to clipboard
Copied
You can put that in the "standard.js" file that Captivate creates or insert it in the HTM file that launches the Captivate SWF.
/Michael
Visit my Captivate blog with tips & tricks, tutorials and Widgets.
Copy link to clipboard
Copied
Does this solution work if the LMS is not SCORM compliant?
Copy link to clipboard
Copied
If your LMS stores data in a different type of database you could adapt the JavaScript to get the data from that instead but of course you wouldn't be able to use the SCORM calls and functions.
/Michael
Copy link to clipboard
Copied
Is it only the Flash Component as imported into Captivate and the Javascript which will have its way of connecting here?Is there anything that I need to define in my Captivate? Variables perhaps...
Thanks.
Copy link to clipboard
Copied
Yes if you want to use the data in Captivate then you need to "transfer" it from Flash to Captivate.
Create one or more user defined variables in Captivate. From Flash send the values to these variables like _root.v_myCaptivateVariable = FlashVariableYouWantToTransfer;
/Michael
Visit my Captivate blog with tips & tricks, tutorials and Widgets.
Copy link to clipboard
Copied
I am still having trouble with the first part, but once I can get the value to display in flash, then I will work on "transfering" it to captivate.
I have decided to test in SCORM1.2, because that is what works best on our LMS... So, I have modified the standard.js file in my captivate templates folder so that the javascript below is included in all published projects:
function returnName(str)
{
return doGetValue('cmi.core.student_name');
}
I will later create a function that works with SCORM 2004 and just name that function something like returnNameST
Then I created the flash object and embeded it in my captivate project. No changes to the code you suggested. The problem is that nothing displays. I tested the animation by supplying some text to it (then inserting into captivate), and that displays, but it does not work with the javascript function. I get nothing displayed at all???
Kind of fustrating because I have to publish all the way to the LMS to test, and then see no results...
I'm not sure if it is just not executing the javascript call, or if it is not pulling any data from the LMS, or if there is something else going on... Shouldn't it be giving me at least the appended "test" message as the string value if nothing is actually returned from the javascript function?
Copy link to clipboard
Copied
I finally figured it out. Below is a link to a tutorial for anyone that is interested in reading SCORM variables in Captivate 5.
Copy link to clipboard
Copied
We haven't upgraded to CP 5 yet. I wonder if anyone has AS2 version of the Flash code.
Thanks for sharing.
Copy link to clipboard
Copied
Thank you all very much for the information. FYI to get this to work in Captivate 5 and SCORM 1.2, you'll want to modify the javascript returnName function to the following:
function returnName(str) {
return g_objAPI.LMSGetValue("cmi.core.student_name"); //returns a string
}
Copy link to clipboard
Copied
Hello Merobertsjr!
I was looking at this thread in the Adobe Forums and would like to look at your tutorial, unfortunately the link seems to have expired.
Is it possible to see this anywhere else? I would like to take a look.
Thank you!
Mark
Copy link to clipboard
Copied
I will post a link to my Moodle site this weekend and share a link when it
is updated. Sorry, I was only testing out ConnectPro.
Thanks,
Copy link to clipboard
Copied
Here is a link to the tutorial.
http://www.vtrainingroom.com/lobby/course/view.php?id=4
Michael www.vtrainingroom.com
Copy link to clipboard
Copied
Thanks for putting up the tutorial, it was very helpful. Unfortunately I am still having problems getting the variables out of my LMS (moodle). When I play the Captivate 5 slide, all I am seeing is the variable name v_myUserName appearing in the slide, rather than the desired student name. Any ideas what I might be doing wrong?
Many thanks
J
Copy link to clipboard
Copied
hi. i have the same problem as jumper. i followed your tutorial but for
some reason all that is displayed on the slide is the variable name. Reading the information from the file works, I've tested that so the problem is with the flash getting the information from the LMS/Java Script. Any ideas?
I added this function to the SCROM_support java script file in the Captivate Publish templates for SCORM. We are using SCORM 1.2:
function returName(str)
{
return (g_objAPI.cmi.core.student_name);
}
Does this need to be placed in a specific position in the file?
And I used the action script code you provided in your tutorial:
import flash.external.*;
this.stop();
var returnValue:String = ExternalInterface.call("returnName",returnValue);
var myRoot:MovieClip = MovieClip(root);
var mainmov:MovieClip = MovieClip(myRoot.parent.root);
mainmov.v_myUserName = returnValue;
Do I need to change the * ater import flash.external.* to something else?
Any ideas?
Thanks
Copy link to clipboard
Copied
Hello,
The function does not need to be in a specific place per say, but you have a typo on the javascript function. The name of the function should be "returnName(str)" not "returName(str)". Missing an "n". Give that a try and let me know if that works.
Michael
Copy link to clipboard
Copied
Thanks for the quick reply. I only made the typo here in the forum.
It's actually working now, but I had to use this function:
function returnName(str) {
return g_objAPI.LMSGetValue("cmi.core.student_name"); //returns a string
}
Now I'm wondering how I can get the last and first name seperated because the LMS gives it back as a string (lastname, first name).
Sorry. I'm not very familiar with flash and java script.
Copy link to clipboard
Copied
To get the first and last name separated.
In Flash...
import flash.external.ExternalInterface;
try{
//Assigns the LMS value to a string
var UserName:String = String(ExternalInterface.call('g_objAPI.LMSGetValue','cmi.core.studen t_name'));
//To Separate the first and last name...
var LastName:String = UserName.slice(0, userName.indexOf(","));
var FirstName:String = UserName.slice(Number(userName.indexOf(",")+2), userName.length);
}catch(err:Error){
trace("Not in an LMS Currently");
}
~Jsswift
Copy link to clipboard
Copied
Jsswift (or anyone else!),
For a complete Flash novice, would you be able to expand on how to get your solution working. I've tried creating a flash project using your code above and then inserting it as an animation within a captivate project, adding a text caption displaying user variables student_name, firstname and lastname but they all come out blank once published. I'm working with Captivate 5.5, Flash CS4 and Moodle 2.0.
Alternatively, if anyone knows an easier way to display the student name (taken from Moodle) to appear on the results page of the course, please advise.
Alistair
Copy link to clipboard
Copied
Hello all,
I am attempting to solve this issue as well.
Has there been a tutorial that is still active that we can look at to get this all solved? I am piecing together different bits of information but cannot get this to work.
Any steps to complete this would be greatly useful.
For example... for the Flash code... does it have to be within a widget? Or just added to captivate as an animation?
Thank you so much,
~ Sean