Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Send variable or action from a HTML5 Animation

Community Beginner ,
Jun 29, 2022 Jun 29, 2022

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 !

372
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

People's Champ , Jun 29, 2022 Jun 29, 2022

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

 

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

 

 

Translate
People's Champ , Jun 29, 2022 Jun 29, 2022

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);

Translate
People's Champ ,
Jun 29, 2022 Jun 29, 2022

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

 

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

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 29, 2022 Jun 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 ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 29, 2022 Jun 29, 2022

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

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

 

Maybe idea ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jun 29, 2022 Jun 29, 2022

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);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 29, 2022 Jun 29, 2022
LATEST

Thanks again, all works first time !

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources