I just finished an ActionScript 2.0 class file meant to be a companion to my JavaScript SCORM API wrapper.

Update: AS3 version now available, too.

Simplified syntax

The idea was simple: give me (and others) a way to make SCORM calls using ExternalInterface without having to constantly type ExternalInterface!

So now instead of typing the tedious

var student_name:String = String(ExternalInterface.call("SCORM.data.get", "cmi.core.student_name"));Code language: JavaScript (javascript)

we can just type

var student_name:String = scorm.get("cmi.core.student_name");Code language: JavaScript (javascript)

To initialize a course, you can just do the following:

var scorm:SCORM = new SCORM();
scorm.connect();Code language: JavaScript (javascript)

Usable return values and automatic ExternalInterface error-checking

The class includes type checking, type conversion, and error-checking to help avoid running into the same annoying issues over and over again. Let the class worry about that stuff, so we can just request our data! 🙂

You can use the boolean return types to ensure your course works as expected. For instance, you could do something like:

var scorm:SCORM = new SCORM();

var isConnected:Boolean = scorm.connect();

if(isConnected){

   var lesson_status:String = scorm.get("cmi.core.lesson_status");

   if(lesson_status == "completed" || lesson_status == "passed"){

      scorm.disconnect();

   } else {

      var success:Boolean = scorm.set("cmi.core.lesson_status", "completed");

      if(success){

         scorm.disconnect();

      }
   }
}Code language: JavaScript (javascript)

Version-neutral

The class has been successfully tested in the ADL SCORM 1.2 test suite (1.2.7), but is designed to be version-neutral, working exactly the same with both SCORM 1.2 and 2004 — just make sure you have the required JavaScript wrapper.

The JavaScript wrapper determines your SCORM mode (1.2 or 2004) when it finds the API; you never have to state which version of SCORM you’re using in your JavaScript OR your ActionScript! If you use this class for SCORM 1.2 and decide to transition to SCORM 2004, you won’t have to change the class file or the JavaScript wrapper.

If you’re keeping the same course functionality and not adding new features, you’ll just need to change some of the variable names in your own course ActionScript, such as going from “cmi.core.lesson_location” to “cmi.location”.

If you want to add SCORM 2004 features, the wrapper is already set up for it, just use the appropriate syntax, such as var progress:String = scorm.get("cmi.progress_measure");.

(In case you’re wondering how the scripts know which version of SCORM is being used, the SCORM version is declared by the imsmanifest file and the course settings when importing the course into the LMS.)

Get the class file

You can get the class file and read the (meager) documentation at https://github.com/pipwerks/scorm-api-wrapper/.

PLEASE give me feedback!

Please try it out and let me know what you think! I’m still testing it out and would appreciate any feedback or suggestions you might have. Thanks in advance!


Comments

ian wrote on January 25, 2008 at 8:15 am:

nice, i look forward to checking out the as3 version. having just rewritten my own scorm wrapper and as3 framework (though i threw the scorm calls into the loader swf document class instead of its own class – i think i'll change that now), i appreciate what you are doing here.

James wrote on January 28, 2008 at 9:08 pm:

Nice work Philip. I'm going to try it out as soon as I get some time. I really like the thought behind the api and combining 1.2 and 2004. This is very thoughtful and will make life easier when transitioning. I may move over to using your AS 2.0 class to check it out as well.

Santhosh Kumar wrote on April 18, 2011 at 3:32 am:

it's nice and one more thing I need to know is , how to get continue the course where actually left over previously….

Similar Posts

3 Comments

  1. nice, i look forward to checking out the as3 version. having just rewritten my own scorm wrapper and as3 framework (though i threw the scorm calls into the loader swf document class instead of its own class – i think i’ll change that now), i appreciate what you are doing here.

  2. Nice work Philip. I’m going to try it out as soon as I get some time. I really like the thought behind the api and combining 1.2 and 2004. This is very thoughtful and will make life easier when transitioning. I may move over to using your AS 2.0 class to check it out as well.

  3. it’s nice and one more thing I need to know is , how to get continue the course where actually left over previously….

Comments are closed.