I have a course and interface that uses and x button, that calls a set to lesson location to save the frame that the course was closed on. But if the x button wasnt used and the user closes the window, how can I detect that and run my close button?
*currently I have a method of using shared objects to save if it was a successfulclose (using the x button) if not (window closed) then just resume at frame 0.
first of all, i'd make sure you save lesson_location at every meaningful point. this way, even if someone exits prematurely, they would be brought back to within a page or two of where they should be. personally, i set the lesson_location at the same time the new content appears, not afterwards. for example, if someone clicks "next", my script for "next" says "load this and save location".
when it comes to exiting, i always use some kind of javascript function and call it via externalinterface. the javascript exit function contains a call to scorm.save() to ensure the data gets saved.
why javascript? because your html file should use an onunload (and onbeforeunload for IE) that invokes 'exit()' in case the user exits by closing the window.
Thanks for you help :) ya it is best to set that information in javascript. Or at least use flash to set it every so often. I got a reply from ADL and they say that its fine to make a set call on lesson location on each frame. Haven't tried, but curious to see any performance issues.
I was curious about that, though I asked what about 22 fps and he said thats fine, now im thinking, when you do a javascript "set" it doesnt hit the lms until the commit... sooo its just a local cheap hit, no?
i'm sure that person didn't realize you meant saving the data every frame (meaning 22 times per second). that's not gonna work.
only save the data when it is meaningful to do so. saving the data in the throughout the progress of an animation wouldn't make sense and would definitely kill your LMS-course connection.
if you really want to save the progress of an animation, keep track of the current frame # in ActionScript and only report the frame # to the LMS when a meaningful event has occurred, such as if play or pause is pressed, if the video finishes, or if the window is closed (using onunload in JavaScript).
User: Nav to page 1 (course ActionScript invokes scorm.set() for bookmark then scorm.save())
User: Nav to page 2 (course ActionScript invokes scorm.set() for bookmark then scorm.save())
User: Nav to page 3 (course ActionScript invokes scorm.set() for bookmark then scorm.save())
User: Closes window (course JavaScript invokes scorm.quit() via window.onunload)
As you can see, since the nav data is saved as soon as the user navigates to a page, when the window is closed it isn't a big deal because the bookmark has already been saved.
scorm.quit merely ensures the LMS connection is closed properly.