Monday, July 5, 2010

Load an Articulate Quizmaker Quiz into your Flash Object and Track Score

This is an update to a previous post in which I proposed a way for you to load a quizmaker quiz into your flash project and track the score. I have now worked on a second version of this that works with most browsers, as the original solution was only for IE 7+.

For the HTML part, simply use Articulates published html, and swap the name of the swf it is loading. (you will also need to change the width and height)

In your flash project, for the onLoadComplete of the quiz, you must set all these variables:


function onLoadComplete(mc:MovieClip)
{
mc.vHtmlContainer=_root.vHtmlContainer;
mc.vCaptureRC=_root.vCaptureRC;
mc.vUseFSCommand=_root.vUseFSCommand;
mc.vLMSPresent=_root.vLMSPresent;
mc.vAOSupport=_root.vAOSupport;
mc.vIE=_root.vIE;
mc.vResumeData=_root.vResumeData;
}


Basically these are all the initializing variables sent by the Javascript/HTML to the flash quiz to let it know if it's in an LMS and also what type of Browser is being used.

There is one small code change that I made to api.js, this was to get the solution working in IE6, For some reason the only way I could get scores tracking in my LMS on IE6 was to add an alert box to the DoOnClose function in quiz.js

function DoOnClose()
{
if (!g_bCloseExecuted)
{
if(IE6)
{
alert("");
}
g_bCloseExecuted = true;

if (g_bAOSupport)
{
PostResultsOnUnload()
}
}
}