Copy link to clipboard
Copied
Hi all! I am working on a project where I want the user to choose an avatar at the beginning, and have it appear throughout the slides.
So far I have created a 'hair' object with different object states for each hair style. I can create a button with an advanced action that sets the object state on the first slide, but I'm a bit stuck displaying the correct object state on subsequent slides. It feels like I need to put the selected object state in a variable, then use the value of the variable to set the object state in each slides On Enter but I can't figure out how to do this. When I choose the 'change state of' action in my advanced action, I can choose the object name and the state, but I can't seem to use a variable value for the state.
I have also tried executing the following javascript but nothing seems to happen - I'm not sure if I need to put this in a function or if it can be executed straight from the script window and my syntax is wrong?
hairstate=window.cpAPIInterface.getVariableValue("v_HairSelection"));
cp.changeState("ImageName",hairstate);
If anyone could offer suggestions it would be greatly appreciated!
Some questions: which version are you using (Help, About Captivate)?
Do you have the same avator (pose included) on all slides, then I would choose to time the avator for the rest of the project. If not, continue reading
You will need to create a user variable (Boolean) for each state. You could do it with JS or with an advanced action with multiple decisions. You didn't tell how many states you have in total? Duplication of a decision in an advanced action is a breeze, and not much editing is ne
...Copy link to clipboard
Copied
Did you try the if/else action?
If v_hairSelection = 1
change state.....
Then create an if statement for each hairstyle.
Copy link to clipboard
Copied
Some questions: which version are you using (Help, About Captivate)?
Do you have the same avator (pose included) on all slides, then I would choose to time the avator for the rest of the project. If not, continue reading
You will need to create a user variable (Boolean) for each state. You could do it with JS or with an advanced action with multiple decisions. You didn't tell how many states you have in total? Duplication of a decision in an advanced action is a breeze, and not much editing is needed. But if you have tons of states, would opt for JS.
A good labeling system can help. Use the same name for a particular state for all avator, like 'Blonde', 'Black'. It is one of the rare situations in Captivate where you don't need to have unique names. Do NOT use the ELSE part of the IF decisions, only the first part since they will be mutually exclusive.
If you need more details, answer the questions above.
Copy link to clipboard
Copied
Thanks so much for the suggestions everyone!
@ullaTH This could definitely work. I'll need to see how much work is involved having an if statement for each element of the avatar in every slide I guess - or is there a way to reuse the same action with different objects in each slide?
Lilybiri I will have possibly two poses (front and side) and 3-4 elements of the avatar with up to 5 options for each. When you say create a variable for each state, what do you suggest to then set the state from that variable? And when you say to time the avatar for the whole project, does that mean I can have an object persisting across multiple slides? If so maybe that would be the easiest solution - set the states once on the front page and then just show/hide the same object on each slide as appropriate?
Stagprime​ Thanks for the link, very helpful info. How do you handle your avatar when the slide is changed? I assumed the avatar object name would change in each slide requiring a new script for each slide which I was trying to avoid.
Copy link to clipboard
Copied
You are correct - additional instances of an image would have new names.
I would reiterate what Lilybiri stated in her post.
Some possibilities
In another post, I used avatars as drag and drop elements - then at the end, in the feedback phase - the avatars are shown based on the avatar that was selected during the question phase. This one uses option 2 above.
Training Supplement - eLearning
Hope that helps.
Copy link to clipboard
Copied
The 'rest of project' timing looks like it will solve my problem nearly perfectly. I can see that it is easy to show or hide the avatar on subsequent slides if necessary - is there any way to change the position of the object by actions? I have been googling this and can see a method to do it using javascript which I will try out if there's not a built-in method.
Copy link to clipboard
Copied
You can apply some effects to the objects and even do some custom paths - HOWEVER, if you move an object that is set for the rest of a project - you are going to end up with some weird results such as seeing two of your object on the stage. One in the original position and one in the new position.
If you want to do some custom movements - I would use separate objects in that case.
Copy link to clipboard
Copied
Do not use any motion path on an object timed for the rest of the project!
Copy link to clipboard
Copied
I did a write up on a similar concept.
Maybe you can find something useful from it for yours.
Using Javascript to Concatenate - A Real State Changer - eLearning