Skip to main content
Inspiring
November 12, 2015
Answered

Call advance action on variable change

  • November 12, 2015
  • 1 reply
  • 2509 views

I can't seem to find a definitive answer to this question on the net.

Can you call an advanced action from Javascript? This would be useful for many reasons, but the situation I currently have is this:

I'm listening to a variable change event based on this documentation

and instead of running a anonymous function I need to call a advanced action.

Is this possible?

I ideally from within a Captivate javascript window.

Many thanks

This topic has been closed for replies.
Correct answer systemIdle

Understand your urgency.

If you are an expert coder with JS then a lot of things are possible.  But accessing Advanced Actions from JS is one of the harder things to pull off.  And for SWF output, you would be far better off trying to code the functionality in an SWF widget than in JS.  HTML5 would be suitable for JS, but ONLY if you know your stuff.

The widget will be ONLY for HTML5 and Responsive projects.


Thanks RodWard

I wouldn't say I'm an expert JS coder by any means, but I had a dig around in the published project code and got a sense of what CPM.js is doing.

I found if I created an Advanced Action in Cp and assigned it to an object on a slide, so the Advanced Action is included in CPM.js I can call the Action by targeting the stage objects data like so: cp.runJavascript(cp.model.data.nameOfStageObject.oca);

I'm not sure if this is the best way or how well this will stand up across browsers and mobile devices (I need to test more), but it seems to work.

Would you have any other suggestions?

1 reply

Inspiring
November 12, 2015

btw I'm using Cp 9

Thanks

RodWard
Community Expert
Community Expert
November 12, 2015

Yes it is, but not with standard functionality in Captivate.

There's a new HTML5 widget currently being developed that does this.  It allows you to add event listeners to Captivate via User Variables that can then trigger Advanced Actions.

Sounds weird I know.  But it's possible.

The widget is currently in BETA.  It will be announced soon on www.infosemantics.com.au

Inspiring
November 12, 2015

Thanks RodWard for your reply.

My project is extremely urgent so not really able to wait for the widget to be announced unless it's like this week

If it can be done with a widget, then surely it can be done with JS? Where are advanced actions stored in a published project after a dev has created a new advanced action?

Thanks