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

Executing advanced action using Javascript in Animate CC

Community Beginner ,
Jan 29, 2018 Jan 29, 2018

I'm trying to execute an advanced action in Captivate when a button created in Animate CC is click.

I've been following this tutorial: How to Trigger Captivate Advanced Actions with Javascript | eLearning

I've created a clickbox called "Menu_btn" which on click executes an advanced action.

My code in Animate CC is:

this.menu_mc.addEventListener("click", fl_MouseClickHandler.bind(this));

function fl_MouseClickHandler()

{

    this.menu_mc.gotoAndPlay('click');

    window.parent.cp.clickHandler(Menu_btn);

}

The "window.parent.cp.clickHandler(Menu_btn);" should execute the advanced action as if the "Menu_btn" clickbox was clicked, but nothing happens.  If I create another button in captivate with the execute JavaScript code "cp.clickHandler(Menu_btn);" it works fine, so I'm not sure why it isn't working in Animate CC. I've replaced the "window.parent.cp.clickHandler(Menu_btn);" with "window.parent.cp.hide("SmartShape_666");" just to check the function was firing and that worked fine.

Has anyone had any look getting the cp.clickHandler() function to work outside of Captivate?

707
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 ,
Jan 30, 2018 Jan 30, 2018

I've also tried "window.cp.runJavascript(cp.model.data.Menu_btn.oca);" and "window.parent.window.cp.runJavascript(cp.model.data.Menu_btn.oca);" but still no luck.

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 ,
Feb 12, 2018 Feb 12, 2018

Hi Josh I am trying to get this to work also, Javascript in captivate the suggestion I had was not successful, I have tried the following

var box = $('#restart_loop')[0]; cp.clickHandler(box); inside captivate on page load or another button and this fires perfectly. but i too wanted to do this same function from animate cc on an .oam button

I have tried the following lines

this.Reset.addEventListener("mousedown", fl_MouseClickHandler.bind(this));

     function fl_MouseClickHandler()

     {

     var box = $(window.parent().'#restart_loop')[0];

     window.parent.cpAPIInterface(box)

      }

or

this.Reset.addEventListener("mousedown", fl_MouseClickHandler.bind(this));

     function fl_MouseClickHandler()

     {

window.parent.cp.clickHandler("restart_loop");

}

or

this.Reset.addEventListener("mousedown", fl_MouseClickHandler.bind(this));

     function fl_MouseClickHandler()

     {

window.parent.cp.clickHandler(box("restart_loop"));

}

None have worked

have you had any success?

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 ,
Jul 13, 2018 Jul 13, 2018
LATEST

I had this same issue when using "clickHandler", trying to trigger a button click in Captivate from a separate Captivate window. "window.opener.cp.HIde(my_button)" works but not "window.opener.cp.clickHandler(my_button)", comes back as undefined.

So I tried "window.opener.cp.clickHandler(window.opener.my_button)" and that worked.

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