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

Send variable or action from a HTML5 Animation

Community Beginner ,
Jun 29, 2022 Jun 29, 2022

Copy link to clipboard

Copied

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 !

Views

196

Translate

Translate

Report

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

 

 

Votes

Translate

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

Votes

Translate

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

Copy link to clipboard

Copied

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

 

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

 

 

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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 ?

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

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

 

Maybe idea ?

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

Thanks again, all works first time !

Votes

Translate

Translate

Report

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