Skip navigation
FrustratedODED
Currently Being Moderated

Converting SCORM Commands from AS2 to AS3

May 9, 2012 11:15 AM

Tags: #as3 #as2 #system #convert #actionscript3 #conversion #scorm #lms #learning #mangement

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;

}

 

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points