Adding Advanced action to layered multi-state object
December 8, 2020
Adding Advanced action to layered multi-state object
December 8, 2020
Newbie 3 posts
Followers: 0 people

Good day!

In my project I have a layered character that I have made into a multi-state object. I wish for the continue button to show only when the last state is shown. I have only been able to be successful at making the whole multi-state object the trigger, not a specific state itself. This must be possible. Any suggestions?

All Comments
Sort by:  Most Recent
Nov 30, 2021
Nov 30, 2021

any updates on what you did?

Like
()
Dec 9, 2020
Dec 9, 2020

For the sake of variety… or for any other readers who may be curious… here is a pretty simple JavaScript example.
First a few assumptions…

  1. You are using a button that reveals the next state of your character
  2. Your character has the name  myCharacter
  3. Your continue button has the name  contBtn
  4. The continue button is hidden at publish
  5. The last state of your character has the name  lastState

The on Success action for the button would be  Execute Javascript

The following code placed on the button would advance the character state and check the state of  myCharacter to reveal the continue button when the state named lastState is displayed.

 

cp.goToNextState(“myCharacter”);

if (cp.getCurrentStateNameForSlideItem(“myCharacter”)==”lastState”) {
cp.show(“contBtn”);
}

 

Of course, you can change the names to be whatever you want but you would simply need to change the names in the code to match.

Like
(4)
Dec 9, 2020
Dec 9, 2020

Thank you! I will check out these resources. I knew it had to be possible.

Like
(4)
(1)
Dec 9, 2020
Dec 9, 2020
>
kpozza
's comment

You’re welcome! Success.

Like
(3)