0 Replies Latest reply: Oct 3, 2014 7:41 AM by JohsJorg RSS

    moduleReadyEvent not firing when project(cp8) is published to flash + scorm

    JohsJorg Community Member

      I want to use the CPAPI_SLIDEENTER event in an external JavaScript.

      The reason is that the authors on the project then don't have to deal with custom variables etc.

      I have succeeded in doing want I want. Everything is ok when I preview, both as Html5 and Flash.

       

      When I publish as:

      • HTML5 + Scorm it is OK
      • Flash + Scorm (both 1.2 or 2004) not working
      • Flash without Scorm it is OK

       

      Its seems that the moduleReadyEvent never fires when published as Flash + Scorm

       

      The problem can be recreated by adding this code (taken from this excellent article Common JS interface) to the standard.js file:

       

      var interfaceObj;
      var eventEmitterObj;

      window.addEventListener("moduleReadyEvent", function(evt)

      {

      console.log("moduleReadyEvent OK "); // --> never happens!!
        interfaceObj = evt.Data;
         eventEmitterObj = interfaceObj.getEventEmitter();
      //check if window.cpAPIInterface is available

      if(interfaceObj)

      {

        //check if window.cpAPIEventEmitter is available

        if(eventEmitterObj)

        {

         //add a listener to CPAPI_SLIDEENTER event

         eventEmitterObj.addEventListener("CPAPI_SLIDEENTER",function(e)

                      {               

                       console.log("CPAPI_SLIDEENTER\n"+JSON.stringify(e,null,"\t"));               

                      });

         eventEmitterObj.addEventListener("CPAPI_VARIABLEVALUECHANGED","cpInfoCurrentSlide",functi on(e)

                      {               

                       console.log("CPAPI_VARIABLEVALUECHANGED\n"+JSON.stringify(e,null,"\t"));               

                      }); 

         eventEmitterObj.addEventListener("CPAPI_INTERACTIVEITEMSUBMIT",function(e)

                      {               

                       console.log("CPAPI_INTERACTIVEITEMSUBMIT\n"+JSON.stringify(e,null,"\t"));               

                      });

         eventEmitterObj.addEventListener("CPAPI_SLIDEEXIT",function(e)

                      {               

                       console.log("CPAPI_INTERACTIVEITEMSUBMIT\n"+JSON.stringify(e,null,"\t"));               

                      });

        }

      }

      });

       

      Has anyone experienced this too? Is it a bug? Am I doing something wrong?