Copy link to clipboard
Copied
Specs:
Captivate 9.0.2.421
Publishing to SWF
Testing by publishing to server
Testing with latest Chrome
Problem code line:
window.cpAPIInterface.setVariableValue("urlparam1", "NotDefined");
If I add this with or without other code in the script window on a slide - it works fine.
If I try to add it anywhere in the standard.js file, the standard.htm file script block, or an external js file linked to standard.htm - it fails; Chrome console throws this error on that line:
Uncaught TypeError: Cannot read property 'setVariableValue' of undefined
Old programmer, but not as big on JS. I'm sure it's something stupid/minor, but I'm pulling out what little hair I have left. Thanks!
Copy link to clipboard
Copied
Is the code wrapped in a function or just in the file?
If it's throwing that error the cpAPIInterface object has not been created yet.
Copy link to clipboard
Copied
Currently, just in the file, but I also tried it in a function and it wouldn't invoke with a call from within Captivate.
At what point does that object get instantiated?
Copy link to clipboard
Copied
It seems like it is created with a call from the SWF.
It should work if you include a function in the standard.js and call that from Captivate.
function getVar()
{
window.cpAPIInterface.setVariableValue("urlparam1", "NotDefined");
}
Are you running this in an LMS?
Copy link to clipboard
Copied
Thanks - I'll get back to that fire shortly.
Some of the courses where this will be used will be in an LMS. So far, this testing has not gone to that step.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now