SCORM “Planets” Example Updated

Update 10/13/2011: I added more comments to the ActionScript code to help explain what each line of code does. I also added a Flash CS4 version of the FLA to the ZIP so more people can access the example.

My “Planets” example (How to Add Basic SCORM Code to a Flash Movie) has proven to be one of the most popular items on pipwerks.com. Unfortunately, it was designed as a quick example and had a bunch of flaws and shortcomings. It’s also about 3 years old and starting to show its age. Since people frequently contact me with questions — many of which were due to the flaws in the example — I decided to update the project.

The new Planets example has a bunch of fixes:

  • Full compliance with SCORM XSD requirements (it includes all those pesky XSD files that really don’t do anything but are required anyway).
  • Upgraded the pipwerks JavaScript wrapper to the latest version
  • Upgraded the pipwerks ActionScript 3 wrapper to the latest version
  • Upgraded SWFObject from 1.5 to 2.2
  • Changed the doctype and markup to HTML5
  • Added an unload handler to the JavaScript to ensure course progress is saved if the learner exits early
  • Added support for tracking progress across attempts using cmi.suspend_data
  • Completely rebuilt the FLA file to remove all timeline-based animation and scripts. Now uses a single ActionScript file, loaded on a single frame. All animations (fade transitions) are handled via ActionScript. This makes the file smaller and hopefully less confusing.
  • The SCORM code is clearly separated from the rest of the movie’s ActionScript; it’s in the same file, but not intermingled with other functions.

I haven’t decided if I’ll create a detailed tutorial to explain the updates; I’ve added a ton of comments to the ActionScript file, and hope it’s clear enough for others to follow.

Download the updated Planets example
The ZIP includes two FLA files: one in CS4 format, and the other in CS5.5. The code, movieclips, and graphic elements inside the FLAs are exactly the same.

New SCORM ebook coming soon!

I'm writing an ebook explaining how to build an HTML-based SCORM course. Subscribe to be notified when it's ready, as well as receive early bird pricing and some free goodies!

No spam, no sharing your email address, unsubscribe at any time. Powered by ConvertKit
Advertisements

29 Replies to “SCORM “Planets” Example Updated”

  1. Philip – thanks a lot for your work on this, I had been trying to work out how to build a SCORM compliant system that retained the nice Flash interface and custom menus for a while with no luck, your idea of using suspend_data for maintaing status data does the trick!

    I’ve built a proof of concept using LibScorm and SCORM 2004 Fourth edition. If you’re interested you can see it here.

  2. @craig

    Interesting take, glad to be of help. In response to your blog post:

    I chose SCORM 1.2 because it is by far the most widely supported version of SCORM. Many of the people who visit my blog need to create SCORM packages that run in systems like Moodle, which don’t have proper SCORM 2004 support yet.

    I may not have explained it clearly enough, but the Planets example uses just the basic RTE functionality of SCORM, which is almost identical between 1.2 and 2004. Since it doesn’t use SCORM 2004’s sequencing and navigation, and doesn’t rely on new or heavily changed features, it would only take a few minutes to upgrade the example to SCORM 2004.

    (The pipwerks wrapper supports both SCORM 1.2 and 2004 using a single AS file and a single JS file, which means switching from 1.2 to 2004 is a snap. You’d need a new manifest and supporting XSD files, though.)

    As far as the pipwerks wrapper versus LibSCORM, I believe the pipwerks wrapper is much simpler. I haven’t used LibSCORM so I can’t speak to it’s functionality, but my understanding is that Joe Nelson put a lot of good work into it, adding a lot of bells and whistles. The pipwerks wrapper was deliberately kept simple; it’s a wrapper, not a framework. Choose whichever best suits your needs.

    Regarding upkeep and maintenance, LibSCORM was produced by the Academic ADL Co-Lab, which is independent of the ADL proper. Therefore neither the pipwerks wrapper or LibSCORM are ADL products and have no guarantees regarding updates. (FWIW thay’re both released open-source and can be modified/updated by anyone.) But it’s all a moot point anyway, because SCORM as we know it is finalized — the ADL announced that SCORM development is complete and there will be no new updates.

    Lastly, the SCORM wrapper for ActionScript is a pure AS3 class; the Planets example imports com.pipwerks.SCORM. I used an include to externalize the AS code in the example, but the wrapper is a class and follows OOP principles.

  3. Ok fair points Philip, thanks for taking the time to reply. Illuminating your reasons on using v1.2 rather than 2004, and the distinction between ADL and ADL Co-Lab had passed me by.

  4. Well, i’ve been reading your files and using your AS3 scorm class. I installed a moodle on my local box. But no matter what i do i get :
    pipwerks.SCORM.connect() called from class file
    connection.initialize called.
    SCORM.API.find: API found. Version: 1.2
    API: [object Object]
    SCORM.data.get(cmi.core.lesson_status) failed.
    Error code: 0
    Error info: n/a

    Trying to set : screen3 for parameter cmi.core.lesson_status
    Connection active? true
    Call result : true
    pipwerks.SCORM.set(cmi.core.lesson_status) success.

    I can set and save but i get never get !

    What do i do wrong ?? Or is it just not working at all ?

  5. I tried them all. suspend_data, lesson_location … I always get the same error :

    SCORM.data.get(cmi.suspend_data) failed.
    Error code: 0
    Error info: n/a

  6. this is also what i get when putting “planets.zip” on my moodle :

    Initializing SCORM class. Checking dependencies: ExternalInterface.available evaluates true.
    SCORM.isAvailable() evaluates true. SCORM class file ready to go! 🙂
    pipwerks.SCORM.connect() called from class file
    connection.initialize called.
    SCORM.API.find: API found. Version: 1.2
    API: [object Object]
    SCORM.data.get(cmi.core.lesson_status) failed.
    Error code: 0
    Error info: n/a
    SCORM.data.get(cmi.core.lesson_status) value:
    __connectionActive: true
    SCORM.data.get(cmi.core.lesson_status) failed.
    Error code: 0 Error info: n/a
    SCORM.data.get(cmi.core.lesson_status) value:
    public function get returned:
    SCORM.data.get(cmi.suspend_data) failed.
    Error code: 0
    Error info: n/a
    SCORM.data.get(cmi.suspend_data) value:
    public function get returned:

    get always fails and never returns any value.. Any idea ? thank you

  7. @eric

    I dont’ know how your Moodle environment is configured or the condition of your course ZIP file, so I can’t really say much.

    I just uploaded the Planets.zip file (as-is, no modifications) into Moodle (1.9) and it worked fine:

    Initializing SCORM class. Checking dependencies: 
      ExternalInterface.available evaluates true. 
      SCORM.isAvailable() evaluates true. 
      SCORM class file ready to go!  :) 
    pipwerks.SCORM.connect() called from class file
    connection.initialize called.
    SCORM.API.find: API found. Version: 1.2
    API: [object Object]
    SCORM.data.get(cmi.core.lesson_status) value: incomplete
    __connectionActive: true
    SCORM.data.get(cmi.core.lesson_status) value: incomplete
    public function get returned: incomplete
    SCORM.data.get(cmi.suspend_data) value: 0,1,1,0
    public function get returned: 0,1,1,0
    

    My guess is that you’ve made a modification of some kind to the Planets example (either the code or the ZIP packaging) or your Moodle installation is wonky. (Yes, that’s a highly technical term!)

  8. Also did a test in Cornerstone :

    Some SCORM function look better but the swf itself doesn’t work at all.
    Here’s the debug info :

    Initializing SCORM class. Checking dependencies: ExternalInterface.available evaluates true. SCORM.isAvailable() evaluates true. SCORM class file ready to go! 🙂
    pipwerks.SCORM.connect() called from class file
    connection.initialize called.
    SCORM.API.find: API found. Version: 1.2
    API: [object Object]
    SCORM.data.get(cmi.core.lesson_status) value: incomplete
    __connectionActive: true
    SCORM.data.get(cmi.core.lesson_status) value: incomplete
    public function get returned: incomplete
    SCORM.data.get(cmi.suspend_data) failed.
    Error code: 0
    Error info: No Error
    SCORM.data.get(cmi.suspend_data) value:
    public function get returned:

    So, so far in conerstone, lesson_status works but the SWF doesn’t work at all, maybe because get(cmi.suspend_data) failed.
    In moodle, you already have the debug info and the SWF works.
    So, so far, i am not very sure of what to do 🙂

  9. This is a fresh install of moodle with the latest package (just installed it and the install report showed success everywhere).. I don’t know really what’s going on…

  10. Sorry for spamming, Planets! didn’t work in Cornetstone because i was using FF and the swfObjects method doesn’t work with FF. Cornerstone works ok, so i’m guessing it’s my moodle version / install …

  11. @eric the ActionScript in the SWF is executing those SCORM calls, so the SWF is working fine. When you say “the SWF doesn’t work at all,” you need to be more specific. There’s a ‘next’ button that must be clicked from the initial page; do you see it? Does it work? Also, what version of Flash Player do you have?

  12. @eric swfobject is cross-browser and works with all versions of Firefox. Perhaps you have an add-on like AdBlock that prevents SWFs from playing correctly?

  13. I ment IE ffffssss 🙂 thanks for replying, i’m reinstalling moodle to see what’s going on, planets works ok with Cornerstone. Thank you.

  14. @eric I’m sorry you’re continuing to have problems, but everything has been tested cross-browser: Firefox, SWFObject, SCORM wrappers, etc. I suspect your issues have something to do with your computer’s setup.

    If you would like to continue this discussion, perhaps you can post at the E-Learning Technology and Development Google Group so we can minimize the comments for this post.

  15. Is there recommended way to zip the files. When I try uploading your zipped file, it works, but when I unzip it and re-zip (without making any changes), it isn’t recognized as SCORM anymore by our LMS, which is SumTotal.

  16. Oops, I found the answer. Windows built-in zip utility seems to be the problem. I used 7-Zip and it worked fine.

    1. Also, be careful not to zip the folder: the imsmanifest.xml file needs to be at the root of the zip. If you zip the folder containing the manifest (as opposed to zipping the contents directly) your manifest will be one-level deep inside the root, and will no longer work in the LMS.

  17. Thanks — that is what happened. Philip, first of all, thanks for all your work on this! I am having trouble though with modifying my course to work like yours. Your planets course works great on my LMS, which is SumTotal. It tracks completion great. However, my course just needs to track completion when the student gets to the last page, but I can’t get that part to work. The LMS recognizes it but it just won’t show completion. I can’t figure out how to modify your tracking of visiting each planet to going to the last page in my course. I am willing to pay you to look at my files. It is probably something very simple. Thanks again!

  18. Philip, I got it to work. I just worked through your How to Add Basic SCORM to a Flash Movie and what do you know it worked. For completion, I put the course completion code on the last page. Thank you so much!

  19. Well, I thought my course was working. It does record completion. But when you relaunch it and stop before the end, it gives you a status of incomplete.

    Here is my code on the first frame of the course (it has about 30 frames on the main timeline but the actionscript here goes across the frames). Can you spot anything that is off?

    import flash.external.ExternalInterface;
    import fl.controls.Button;
    import com.pipwerks.SCORM;

    var scorm:SCORM;
    var lmsConnected:Boolean;
    var lessonStatus:String;
    var success:Boolean;

    scorm = new SCORM();

    lmsConnected = scorm.connect();

    if(lmsConnected){
    lessonStatus = scorm.get(“cmi.core.lesson_status”);
    if(lessonStatus == “completed” || lessonStatus == “passed”){
    scorm.disconnect();
    } else {
    success = scorm.set(“cmi.core.lesson_status”, “incomplete”);
    scorm.save();
    }
    } else {
    trace(“Could not connect to LMS.”);
    }

  20. Hi again Philip, turned out my client only has an LMS with SCORM 1.2 in the end!
    I’m testing this zip in the ADL TestSuite for 1.2, and after the suite says “The manifest is well-formed”, I’m getting ‘ERROR: The manifest is not valid against the controlling documents… eg “ERROR: Element type ‘general’ must be declared. ERROR: Element type ‘langstring’ must be declared.. etc etc

    Any ideas?

  21. The ADL Test Suite is a strange beast. One of the most common gotchas is that you have to have a copy of the course’s XSD support files on your desktop! I have no idea why, but it’s a requirement and frequently trips people up. That’s why I switched to SCORM Test Track.

Comments are closed.