Highlighted

Do an action using the state of an object on Captivate

New Here ,
Mar 15, 2019

Copy link to clipboard

Copied

Good Morning everyone,

I'm trying to create an action based on the status of an object: for example "IF the status of this object is A, then do this action". Do anyone know how (and if) is it possible to do this? I'm trying with conditional actions, but I don't know how to indicate the object status in the IF panel.

Thank you for the help

Views

220

Likes

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

Do an action using the state of an object on Captivate

New Here ,
Mar 15, 2019

Copy link to clipboard

Copied

Good Morning everyone,

I'm trying to create an action based on the status of an object: for example "IF the status of this object is A, then do this action". Do anyone know how (and if) is it possible to do this? I'm trying with conditional actions, but I don't know how to indicate the object status in the IF panel.

Thank you for the help

Views

221

Likes

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
Mar 15, 2019 0
Engaged ,
Mar 15, 2019

Copy link to clipboard

Copied

That would require some JavaScript, as there's no System Variable that carries an object's current state. This forum post might help:

Is there a way to poll the current state of an object for use elsewhere?

Anyway, it might be worth considering to intercept the events that change the state in the first place, and track those changes in a tracking variable of some sort instead.

Likes

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
Reply
Loading...
Mar 15, 2019 0
Adobe Community Professional ,
Mar 15, 2019

Copy link to clipboard

Copied

Or you could just do this with vanilla Captivate functionality by having a User Variable keep track of the object's state.  You just need to ensure that your Actions always assign the variable to have a value that corresponds exactly with the state of the object so that as the object's state is changed, so does the variable value.  You cannot currently check Object State in the decision block of a Conditional Action, and that's why you need to use the User Variable.

Likes

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
Reply
Loading...
Mar 15, 2019 0
dan561 LATEST
Engaged ,
Mar 15, 2019

Copy link to clipboard

Copied

There's an even easier way, although still with JS:

var currentState = cp.getCurrentStateNameForSlideItem(targetID);

This gives the name of the current state of that target. Much easier than using the index of the state array.

So, to answer the OP, you can do this in JS to do something if an object named shape1 is in a particular state:

currentState = cp.getCurrentStateNameForSlideItem("shape1");

if(currentState == "state2"){

    cp.show("text2");

    cp.hide("text1");

    cp.changeState("shape5","Normal");

}

If you want to use that state in an advanced action, send its value to a Captivate variable, var_myVar, for example:

The first line of your advanced action can be an Execute Javascript that says

window.var_myVar = cp.getCurrentStateNameForSlideItem("shape1");

Then you can use the variable var_myVar in the rest of the advanced action.

Likes

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
Reply
Loading...
Mar 15, 2019 0