I've used this code many times, in many LMS systems without issue. Now I'm converting to AS3 and have run into problems. What part of this needs to change to work in ActionScript 3?
First Frame - Initialize LMS Connection, Get Bookmark Location
var lmsInitialized = true;
var lmslocation = "";
var lmslocationreturned = "";
var lmsbookmark = true;
if (lmsInitialized == true) {
fscommand("LMSInitialize()");
// Get lesson location data from LMS (bookmark)
fscommand("LMSGetValue", "cmi.core.lesson_location,lmslocationreturned");
}
// Go to LMS bookmark.
_root.onEnterFrame = function() {
if (_root._currentframe<=3) {
if(lmsbookmark == true){
gotoAndStop(Number(lmslocationreturned));
lmsbookmark = false;
}
} else {
delete _root.onEnterFrame;
}
}
Every Frame - Send Bookmark Location
lmslocation = _root.currentframe;
fscommand("LMSSetValue","cmi.core.lesson_location,"+_root.lmslocation. toString());
fscommand("LMSSetValue","cmi-core.exit,suspend");
fscommand("LMSCommit())"
Final Frame - Send Score, Send Completion Status, Reset Bookmark
if (lmsInitialized == true) {
//Send a score of 100% since the course is completed.
fscommand("LMSSetValue", "cmi.core.score.raw,100");
//Send a lesson status of 'complete'.
fscommand("LMSSetValue", "cmi.core.lesson_status,Complete");
//Reset bookmark value to frame 1.
lmslocation = 3;
fscommand("LMSSetValue", "cmi.core.lesson_location,"+_root.lmslocation.toString());
//Tell the LMS that this course is finished.
fscommand("LMSFinish", "\"\"");
//Save the data that was just sent to the LMS database.
fscommand("LMSCommit()");
//Disconnect from the LMS.
lmsInitialized = false;
}
North America
Europe, Middle East and Africa
Asia Pacific