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

Got Next/Previous State in a custom action

Enthusiast ,
Dec 06, 2016 Dec 06, 2016

Copy link to clipboard

Copied

Is there any way to recreate "go to next/previous state" in a custom advanced or shared action? I need to be able to trigger variable changes off the commands, but they aren't in the dropdown menus for standard or conditional actions.

TOPICS
Advanced

Views

356

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 1 Correct answer

Enthusiast , Dec 07, 2016 Dec 07, 2016

Thought about it and solved the problem by digging in the CPM.js file and finding the jscript that controls the go to next state and go to previous state actions.

(NOTE:  I did give up on using an "on click" entry as found in InDesign or Animate since it seemed like it might be incompatible with Captivate)

Let's use an object with 5 states as an example.

To bring the object up on entry in a state that allows both buttons to work on entry create the following advanced action:

Change State of <object

...

Votes

Translate

Translate
Enthusiast ,
Dec 07, 2016 Dec 07, 2016

Copy link to clipboard

Copied

LATEST

Thought about it and solved the problem by digging in the CPM.js file and finding the jscript that controls the go to next state and go to previous state actions.

(NOTE:  I did give up on using an "on click" entry as found in InDesign or Animate since it seemed like it might be incompatible with Captivate)

Let's use an object with 5 states as an example.

To bring the object up on entry in a state that allows both buttons to work on entry create the following advanced action:

Change State of <object name> to <state name>

(if I wanted to have the object start with an equal number of clicks for previous and next state command, I would select the state name assigned to the second new state I created.)

Assign <variable> with <literal>

(in order to make the conditional sync up with the current view on entry, this number would be 3 - the midpoint of the variable value range)

Here's the conditional action for "Go To Next State" that will disable the "Next State" button when it reaches the last state created:

IF

<variable> is not equal to <literal>

(for example, if the object had 5 states, and you create the variable with a value of 1 - the literal number here would be 5, as each click will increment the value by 1 as shown below)

THEN

Execute JavaScript 'cp.goToNextState("object name");cp.actionChoicePauseMovie();' in current window

Increment V <variable> by 1

Enable <Go To Previous State Button name>

ELSE

Disable <Go To Next State Button name>

and here's the conditional action for "Go To Previous State" that will disable the "Previous State" button when it reaches the object's default state:

IF

<variable> is not equal to 1

(the variable is created and assigned a value 1 - therefore the default state will occur when the value reaches 1)

THEN

Execute JavaScript 'cp.goToPreviousState("object name");cp.actionChoicePauseMovie();' in current window

Decrement <variable> by 1

Enable <Go To Next State Button name>

ELSE

Disable <Go To Previous State Button name>

the actions above prohibit the states from cycling. The states can go from default through intermediate to last state (1, 2 3, 4, 5), last  through all intermediate to default (5, 4, 3, 2, 1) and back and forth infinitely within this series selecting the buttons associated with the actions, but cannot switch directly from 5 to 1 (4, 5,1) or from 1 to 5 (2, 1, 5) as the standard advanced action allows.

The variable value can also be used to more than simple state changes. It can trigger feedback or open/close branched activities based on the selections made by simply adding i to the IF and ELSE lines as needed.

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