Why isn't this Javascript working?
Hello,
I am using Captivate 9.
I am trying to have the project pause when the user opens the TOC, and play again when he closes it or makes a selection in the toc.
Here is the code:
window.addEventListener("moduleReadyEvent", function(evt) { window.cpAPIEventEmitter.addEventListener('CPAPI_VARIABLEVALUECHANGED',function(e){ if(e.Data.oldVal===0){
window.cpAPIInterface.setVariableValue("cpCmndResume", 0);
window.cpAPIInterface.setVariableValue("cpCmndPause", 1);
console.log('opened TOC') }
else if(e.Data.oldVal===1){
window.cpAPIInterface.setVariableValue("cpCmndResume", 1);
window.cpAPIInterface.setVariableValue("cpCmndPause", 0);
console.log('closed TOC') }
},'cpCmndTOCVisible') });
The right if-conditions are true when they are suppposed to be, but I can't seem to the playbar to stop and continue.
