Skip to main content
Known Participant
June 29, 2022
Answered

Send variable or action from a HTML5 Animation

  • June 29, 2022
  • 1 reply
  • 464 views

Hi,

 

Is it possible to send a variable or activate a captivate action using javascript from a HTML5 animation ?

I try with something like this but don't works : 

 

var vid = document.getElementById("myVideo");
vid.onended = function() {
     window.cpAPIInterface.setVariableValue('cpCmndGotoFrame', 300);
};

 

For information, I really need to use a HTML5 Animation.

 

Thanks !

    This topic has been closed for replies.
    Correct answer TLCMediaDesign

    I try also to disabled a button but don't works 😞

    window.parent.document.getElementById("Button_66").disabled = true;

     

    Maybe idea ?


    to disable use:

     

    window.parent.cp.disable("Button_66");

     

    If you want to call an advanced action, the method I use is to create an invisible button with the advanced action attached to it. Then you can execute this Javascript:

     

    window.parent.cp.runJavascript(cp.model.data[ "ObjectWithActionName" ].oca);

    1 reply

    TLCMediaDesign
    Inspiring
    June 29, 2022

    The animation is running in an iframe so you need to access the parent:

     

    window.parent.window.cpAPIInterface.setVariableValue('cpCmndGotoFrame', 300);

     

     

    AschillesAuthor
    Known Participant
    June 29, 2022

    Oh thank you so much, that's work perfectly !

    And maybe can you say me how can I call advanced action with the same process ?

    AschillesAuthor
    Known Participant
    June 29, 2022

    I try also to disabled a button but don't works 😞

    window.parent.document.getElementById("Button_66").disabled = true;

     

    Maybe idea ?