swf loaded into Captivate parent retrieve cmi.core.student_name?

173 views
Skip to first unread message

brokenindexfinger

unread,
Nov 20, 2009, 5:39:32 PM11/20/09
to eLearning Technology and Development
Hello All,

I've visited this forum before but never posted. I've scoured the Web
today in search of anything which remotely indicates that this can be
done:

I have a prospect who wants a custom SWF that will gather complex
survey data and store to a database. All a go there. The trick is that
she wants this survey to be deployed by way of a Captivate SCORM
package, such that her in-house developers could import the SWF, and
the swf would function like an imported animation. The custom SWF
would need to get cmi.core data in order to track learners for
reporting. I've tried decompiling the Captivate SWF to look for an
ExternalInterface call to a JS API. I've tried calling functions in
what looks like the Captivate API from the imported SWF. Nothing seems
to work.

Am I missing something, or trying to do something that's impossible?

Thanks for any assistance,
brokenindexfinger

Philip Hutchison

unread,
Nov 23, 2009, 1:41:01 PM11/23/09
to elearning-technolo...@googlegroups.com
Unfortunately, plopping a Captivate SWF into the middle of an existing SCO and having it plug into that SCO's SCORM system is not very easy.

Three thoughts:

1. You could make the Captivate SWF a separate SCO and convert your course into a multi-SCO course.  (This doesn't sound like it will work for your situation since it sounds like the developers want to insert the SWF into a page mid-SCO.)

2. If you try to have the Captivate SWF plug into your course's SCORM system, you'll run into a number of issues.
  • SWF-SWF communication -- the Captivate file is designed to communicate with its HTML file (which contains Adobe's SCORM JavaScript code), not with another SWF.
  • The Captivate SWF will use Captivate's SCORM functions, which might not be named the same as yours (SCORM calls are generally wrapped in custom functions, and these functions are not standardized at all)
  • If you manage to get the Captivate file communicating with your course's SCORM system, the Captivate file will try and send LMSInitialize and LMSFinish commands to the LMS. You will *not* want these to be successful if you're mid-SCO. You'd need to disable them.
3. The best solution is probably to have the Captivate files communicate with your course using some other method. If you're using Captivate 4, you can use the new "variables" API and have your course request the data from the survey using these variables. If your course is Flash-based, it's easy to get the variables directly from the Captivate SWF (assuming they're both using the same version of ActionScript). If your course is HTML/JavaScript-based, you could use the pipwerks CaptivateController to query the SWF for data.

- philip



--

You received this message because you are subscribed to the Google Groups "eLearning Technology and Development" group.
To post to this group, send email to elearning-technolo...@googlegroups.com.
To unsubscribe from this group, send email to elearning-technology-and...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/elearning-technology-and-development?hl=.



brokenindexfinger

unread,
Nov 23, 2009, 3:30:58 PM11/23/09
to eLearning Technology and Development
Thanks Philip,

This is really helpful.

It actually wouldn't be a Captivate SWF plugged into a custom SCO, if
would be my custom SWF imported into the Captivate course, and then
the Captivate course published to SCORM for delivery in Moodle 1.9+.

What I need is to be able to get cmi.core.student_name into my custom
SWF, so I can connect the survey data with a specific user.

One solution, though not ideal, is to simply add my own api wrapper
file to the Captivate .zip after it's published. I add the .js file,
update the manifest, add an import to the .html file, rezip, and it's
a go. What I found was that I was able to get student_name into the
imported swf, but I had to first initialize, then call for
student_name. You say this is a bad idea? Is this because it will wipe
out anything the Captivate SCO has already saved, or cancel the
Captivate SCO's open session?

I also tried calling Captivate's dataFromFlash() in scorm_support.js
using ExternalInterface. It didn't seem to work. This might be because
I'm not sure which values I'm supposed to be sending in the function
call). Is that a reasonable strategy? Or is the Captivate wrapper too
whacked to try to use it? I decompiled the Captivate SWF, but am
having a hard time spotting the actual functions I would call from
there. For some reason, nothing is simple. I can't seem to spot a
basic call to get a single var from the LMS.

I've also looked at Captivate 4's Actions functionality. But I'm not
seeing where that allows me to get data from cmi.core... I'm actually
not seeing much functional documentation on using Actions at all. Does
anyone on this forum know about the secret Adobe Captivate
documentation that actually tells you what you need to know. :)

Another thing we thought about was adding a PHP script to the SCORM
module, which my little custom imported swf could call for the data it
needs. That would be surefire solution, but it would restrict the
customer to the Moodle LMS. It would circumvent having to finesse the
Captivate SCO, though.

Thanks for any help, oh ID scripting experts.
Humbly,
brokenindex (Amy)

Philip Hutchison

unread,
Nov 25, 2009, 2:32:26 AM11/25/09
to elearning-technolo...@googlegroups.com
If I understand you correctly, you just need to get the value of one of the SCORM CMI elements from the LMS, then import it into your SWF.

Since you're wrapping it all in a Captivate course, we can take advantage of Captivate's SCORM wrapper.  Here's one way to do it:

Getting data from LMS.

I suggest doing this via JavaScript.  Captivate's SCORM wrapper uses the name "g_objAPI" to refer to the SCORM API. To get the data from SCORM, just use the standard SCORM API with g_objAPI:

g_objAPI.LMSGetValue("cmi.core.student_name"); //returns a string


Use ExternalInterface to send the data from JS to AS

Create a JavaScript function that can be invoked via ExternalInterface in your custom SWF:

function getStudentName(){
   return g_objAPI.LMSGetValue("cmi.core.student_name");
}


Then use ExternalInterface in your custom SWF to grab the data:

var student_name:String = ExternalInterface.call("getStudentName");


------

Note: If you want to adapt this code to be able to get other SCORM data, just refactor the JS function and ExternalInterface call:

//In your JS
function getScormData(CMI_element){
   return g_objAPI.LMSGetValue(CMI_element);
}

//In your AS
var student_name:String = ExternalInterface.call("getScormData", "cmi.core.student_name");
var student_id:String = ExternalInterface.call("getScormData", "cmi.core.student_id");
//etc.


- philip



brokenindexfinger

unread,
Nov 25, 2009, 12:33:48 PM11/25/09
to eLearning Technology and Development
That makes sense, just adding a function to the Captivate wrapper, and
calling that. I was trying to find a function already in the Cap
wrapper that I could call. Making it more complicated than it needed
to be. With your approach, the manifest will not have to be modified,
and the index.html will not need to be modified either.

Thanks so much for the help.
-A

On Nov 25, 1:32 am, Philip Hutchison <platelu...@gmail.com> wrote:
> If I understand you correctly, you just need to get the value of one of the
> SCORM CMI elements from the LMS, then import it into your SWF.
>
> Since you're wrapping it all in a Captivate course, we can take advantage of
> Captivate's SCORM wrapper.  Here's one way to do it:
>
> *Getting data from LMS.
> *
> I suggest doing this via JavaScript.  Captivate's SCORM wrapper uses the
> name "g_objAPI" to refer to the SCORM API. To get the data from SCORM, just
> use the standard SCORM API with g_objAPI:
>
> g_objAPI.LMSGetValue("cmi.core.student_name"); //returns a string
>
> *Use ExternalInterface to send the data from JS to AS
> *

stazpaz

unread,
Dec 2, 2009, 10:42:22 AM12/2/09
to eLearning Technology and Development
Hi,

Sorry I am a bit new to all this and have been thrown in at the deep
end.

This looks like just the solution I need- please can I just check
where I put the getStudentName javascript function (is it somewhere
within the scorm_support.js file?)

I keep getting an undefined variable.

Thanks

Stu
> > - philip- Hide quoted text -
>
> - Show quoted text -

Philip Hutchison

unread,
Dec 2, 2009, 1:03:44 PM12/2/09
to elearning-technolo...@googlegroups.com
You have to create the getStudentName JavaScript function... it isn't in any of the default Captivate files.

Type it up (or copy/paste) and place it in the <head> of your HTML file like you would any other script.  You could also paste it into the bottom of your scorm_support.js file.

Be aware that if you re-publish your project Captivate will re-generate these files and erase any edits you make to them. Keep backup copies!

- philip


--

You received this message because you are subscribed to the Google Groups "eLearning Technology and Development" group.
To post to this group, send email to elearning-technolo...@googlegroups.com.
To unsubscribe from this group, send email to elearning-technology-and...@googlegroups.com.

stazpaz

unread,
Dec 9, 2009, 4:59:11 AM12/9/09
to eLearning Technology and Development
thanks for your help

On Dec 2, 6:03 pm, Philip Hutchison <platelu...@gmail.com> wrote:
> You have to *create *the getStudentName JavaScript function... it isn't in
> > elearning-technology-and...@googlegroups.com<elearning­-technology-and-development%2Bunsu...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/elearning-technology-and-development?h....- Hide quoted text -
Reply all
Reply to author
Forward
0 new messages