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

Execute advanced action within JavaScript

Community Beginner ,
Dec 20, 2017 Dec 20, 2017

Copy link to clipboard

Copied

Hello everyone,

I am storing LevelProgress variable at localStorage and I want to execute different Advanced Actions based on values of LevelProgress.

However nowhere in documentation I can find how to execute Advanced Action with JavaScript.

Have anyone tried to do that?

I'd like to achieve this without creating extra buttons/click boxes/objects is possible. Purely triggering JavaScript on Slide enter.

Thank you.

TOPICS
Advanced , Advanced actions , Editing

Views

2.0K

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 Expert ,
Dec 20, 2017 Dec 20, 2017

Copy link to clipboard

Copied

Slide enter can trigger an advanced/shared action as well, no need for a button event at all. I would retrieve the value from LS and use an advanced action.  I will leave you to the JS experts.

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 ,
Dec 20, 2017 Dec 20, 2017

Copy link to clipboard

Copied

Hey Lilybiri,
Thank you for such swift reply.

Yes, it is indeed easy to trigger Advanced Action on Slide enter.
The reason why I've mentioned triggering JavaScript without extra objects is because I've seen several solutions here on forums and Adobe's eLearning Blog:
Re: Call advance action on variable change

How to Trigger Captivate Advanced Actions with Javascript | eLearning

However I hope that maybe there is an easier way for my particular case.

If there is still no other way I am afraid I'll have to create several dummy click boxes as I have several Advanced Actions (at least 8 at the moment).

Which makes solution far from elegant.


Thanks

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 Expert ,
Dec 20, 2017 Dec 20, 2017

Copy link to clipboard

Copied

You can combine quite a lot of commands in different decisions in one advanced action. Are you sure you need so many different actions? I will not discuss the value of JS to extend CP-s functinoality. It may be just my personal suspicion, that I often see JS exsperts doing everything with JS, even if it would be easier with advanced/shared actions (which will be converted to JS on runtime). Since for most clients it is much easier to manage/edit advanced actions than to plunge into JS (probably in an external JS file for convenience) I stick with advanced actions and the CpExtra widget whenever possible. For work flows that are impossible with CP, like randomization, arrays, formatting numbers I will switch to JS.

Beware: I do respect the wonderful JS experts a lot, several are helping on this forum to share their expertise. In my professional life I had to use too many programming languages, happy now to take it easy with CP's advanced actions. Too lazy...

BTW CpExtra is te most wonderful widget I ever used. It is not free, but one of the features is to call an advanced action from in another advanced action.

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 ,
Dec 20, 2017 Dec 20, 2017

Copy link to clipboard

Copied

I am using advanced actions to Show smart shapes and travel between slides. Which is quite a trivial task.

However I've found that it is quite difficult for me to "think" when things are scattered around amongst different actions and variables attached to different objects in Captivate.

I am sure with more experience I will be much more comfortable at looking at the project as a whole.
Also copy/paste/renaming experience with text file is somewhat more straightforward to me at this moment.

On second read I better understand your point.
So the idea is to read LS variable, possibly assign it's value to Project's local variable and execute appropriate Advanced Actions based on it's value. Without performing this operation through JavaScript which I planned initially.
I'll try this now.

However I'd still like to keep this topic open as this might be interesting to others as well.

Regarding CpExtra that's a great suggestion, thank you.

And this "widget" looks really great. The only issue is that we are currently not 100% sure about deployment platforms and from what I know there are some limitations (standalone apps are not 100% supported as I understand). So while I'd totally love to grab one and use it's awesome features, at this moment it might be better not to rely on third party add-ons if possible, no matter how tempting.

Thank you again for you help.

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 Expert ,
Dec 20, 2017 Dec 20, 2017

Copy link to clipboard

Copied

Stanalone is only possible with Flash output, and at this moment I consider it not wise to focus on SWF output anymore since the EOL of Flash player is announced. If there will be a standalone feature in the future (unless you want the app output for Android/iOS) it should be HTML5 based. That widget is only for HTML5 output.

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 ,
Dec 20, 2017 Dec 20, 2017

Copy link to clipboard

Copied

Yes, there is such possibility that we might need to have a standalone mobile app (which is really troublesome as very few LMS support xAPI on mobile within app. The only one I've found so far is Captivate Prime).

Also without CpExtra I think there is no way to trigger Advanced Action from within Advanced Action so that's another reason why I want to try doing that with JavaScript.

Thanks.

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 Expert ,
Dec 20, 2017 Dec 20, 2017

Copy link to clipboard

Copied

Indeed, but I offer find a way around that limitation. An underestimated feature of Captivate is Shared actions, looks sometimes like I am the only one talking about them. They can save a lot of 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
Community Beginner ,
Dec 20, 2017 Dec 20, 2017

Copy link to clipboard

Copied

Lilybiri  wrote

Indeed, but I offer find a way around that limitation. An underestimated feature of Captivate is Shared actions, looks sometimes like I am the only one talking about them. They can save a lot of time.

That's true however in my case I am not sure how to utilise them.

What I am trying to do is (pseudocode):
if (LevelProgress == 1)

{
show Object A;
show Object B;

}

else if (LevelProgress == 2)

{

show Object A;
show Object B;
show Object C;
show Object D;

}

else if (LevelProgress == 3)

{
show Object A;
show Object B;
show Object C;
show Object D;

show Object E;

show Object F;

}

Basically I want to bring user back to a stage where they left off.
As some elements in my Lesson menu unlock after certain actions. And I'd like to retain this progress.

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 Expert ,
Dec 20, 2017 Dec 20, 2017

Copy link to clipboard

Copied

No shared actions here but 3 decisions. I would create 3 groups as well, iinstead of the 6 objects.

First decision 'Level1'

iF var is equal to or equal to 1

    Show Gr_1                                      Gr_1 has both Object A and B

Second decision 'Level2

iF var is equal to or equal to 2

    Show Gr_2                                       Gr_2 has both Object C and d

Third decision 'Level3'

iF var is equal to or equal to 3                Gr_3 has both Object  E and F

    Show Gr_3

I used the AA feature that all decisions are always evaluated.

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 ,
Dec 20, 2017 Dec 20, 2017

Copy link to clipboard

Copied

Objects are on different slides sometimes so grouping probably won't work (at least to my understanding), but I see the idea.
Thank you

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 Expert ,
Dec 20, 2017 Dec 20, 2017

Copy link to clipboard

Copied

I see, but you can show any object on any slide with the same action.

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
Explorer ,
Jul 03, 2019 Jul 03, 2019

Copy link to clipboard

Copied

Thx!

This is working but not if you call the 'dummy click box' (in normal slide since you can not name buttons in a masterlide) from a MASTER SLIDE. (Function return an undefined 'id' message)

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 Expert ,
Jul 03, 2019 Jul 03, 2019

Copy link to clipboard

Copied

A lot has been published about using JS, where the same could have been done with advanced/shared actions which ae a lot more powerful than most know. There is a logical explanation IMO. Some developers are very familiar with JS and can do whatever they want with it before they used Captivate. For them it doesn't pay to put time in learning the point-and-click language of Captivate's actions which are much more powerful than most think (I had congratulations in the past from real JS experts for some of my solutons). However I regret that lot of CP users without programming skills suppose they need to use JS and just copy/paste scripts found somewhere. Hope you understand my point of view, and why I try to post lot of use cases with advanced/shared actions. They are also much easier to understand by clients than JS scripts. 

I never had to use 'dummy' interactive objects even for very complicated advanced actions. If you want to call an advanced action from another action, have a look at the very powerful CpExtra widget by InfoSemantics (Rod Ward's company).

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
Explorer ,
Jul 23, 2019 Jul 23, 2019

Copy link to clipboard

Copied

LATEST

I agree to a point, but there are easy JavaScript solutions available that will save you a ton of clicks action-building in Captivate's  advanced action builder. If you don't want to code, by all means load up advanced actions with multiple tabs and individual actions, but why discourage others from expanding their skill sets a bit if it can make things easier?

If I can solve a problem easily without JavaScript I will. It's just that sometimes JavaScript is the best bet; it has saved me a lot of time building simulations.

And by the way I learned Captivate's point-and-click advanced actions before I learned JavaScript.

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
Engaged ,
Dec 28, 2017 Dec 28, 2017

Copy link to clipboard

Copied

I started out looking at everything from the point of view of a programming language - wanted to be able to call everything from JS, but Captivate isn't really set up that way. I'm now combining clickboxes into slides to handle decisions that are common to several buttons/dragdrop events, etc, and that can call other JS snippets if needed. It does break up the code somewhat, but it's easier in the long run than trying to force programming concepts onto the Captivate AA model.

Shared actions can be good, too, but beware of changes as a project develops. Shared actions can't be modified once saved and in use. I find it easier to duplicate actions in most cases instead, although it makes for a much longer list.

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 Expert ,
Dec 28, 2017 Dec 28, 2017

Copy link to clipboard

Copied

Success, but I had to debug several projects with many duplicated advanced actions that caused choking. Shared actions did solve that in an easy way.  Even when you have to edit a shared action, it takes me less time to switch the shared actions than to edit all those duplicate advanced actions. It is all about the workflow, I embraced shared actions from the beginning and learned how to use them. It needs also a different preparation but that just my personal opinion. I try to avoid duplicate advanced actions as much as possible.

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