August 13, 2019
Change state variable to endlessly select and deselect an image
Comments
(8)
August 13, 2019
Change state variable to endlessly select and deselect an image
Newbie 8 posts
Followers: 0 people
(8)

Dear community,

I have created a slide in an online module where I ask learners to select up to 4 images. The images are inserted in gray scale (state 1) and when selected change state to their colored version (state 2). Now due to their task it is possible that they decide to deselect an image again after having selected it in the first place.

For this to work I created a variable (“clickendlessly”)  and when running the Advanced Action (conditional) the variable “is equal to 0” so that a click on an image changes its state to state 2 (color). The variable is toggled so “if ELSE” by clicking again it changes back to gray (state 1). So far so clear.

Now, when I switch between the 4 images, e.g. I first clicked image 1 and it changed its color to state 2 and I click on image 2, what happens now is that the first click kind of only selects the image and only when selected by clicking it again the advanced action is “released” and change of state therefore needs a second click. Once selected I can change state again and again. But as soon as I move on to another image I need to select the image first (click 1) and change state/color works only with click 2.

Question: Is that how it is and I have to live with it OR is there any way around it? So that whenever clicking on an image it changes color right away, no need for the “pre selection process”?

Help would be great!

Thanks in advance!

Jane

8 Comments
2019-11-04 13:15:30
2019-11-04 13:15:30

You need a variable for each image, Booleans.  Reason why I suggested a shared action, because you need exactly the same action for each of the images with 4 parameters: the image, the two states and the Boolean variable.

Like
(1)
2019-08-13 15:09:49
2019-08-13 15:09:49

Hi Jane!

Sounds like Lieve got you right if you use only one variable for all images it will continue to change once you click from one to another. For example, you click on the first image and you turn the variable clickendlessly=1. Then you select the second image, but as the variable has already been changed it won’t function as intended and instead will turn back to clickendlessly=0. That’s why you had to click twice to the second image to make it work as intended.

I would suggest creating four variables, like clickendlessly_1, clickendlessly_2, etc. Then you could use a separate variable for each image and they would all work as you wanted.

Just remember if you create multiple slides like this you will either have to reset all variables to 0 on entering the slide or you have to create new variables, so the situation wouldn’t happen again when you change the value for one  variable in one slide and it’s already been turned from 0 to 1  when you come to the next slide.

I hope this helps!

Karlis

Like
(1)
(4)
>
FasterCourse e-learning templates
's comment
2019-08-13 15:16:33
2019-08-13 15:16:33
>
FasterCourse e-learning templates
's comment

Hmmm…. would prefer better names, indicating that it is a variable, by starting with v_one…. Since the unique name law in Captivate is very critical, it avoids the situation where you have the same name attached to an object or an action.

Moreover I would NOT use a advanced action but a SHARED action in that case, with the image and the variable as parameters. Resetting the variables On Enter for each slide is necessary and will allow to reuse the variables on multiple slides. It is necessary for that On Enter action to reflect on the desired situation when returning to a slide: keep the images in the state where they were when you left? Never use more variables than necessary is a golden rule as well. You can avoid having to create variables by using a trick I explained in this post:

http://blog.lilybiri.com/rare-tips-for-shared-actions

 

Like
(2)
>
FasterCourse e-learning templates
's comment
2019-11-04 13:10:35
2019-11-04 13:10:35
>
FasterCourse e-learning templates
's comment

I have never used shared action before. I don’t create multiple slides like this. It’s just one slide with four images on it and each are supposed to do the same thing. Do I still use shared action?

Like
>
janen78798798
's comment
2019-11-04 13:12:13
2019-11-04 13:12:13
>
janen78798798
's comment

Of course you can….

Like
>
Lieve Weymeis
's comment
2019-11-05 09:11:51
2019-11-05 09:11:51
>
Lieve Weymeis
's comment

Have a look at my blogs about shared actions. My approach is for each action: should I use a shared or an advanced action? I have some thumb rules to make a decision. Some of them will be found in this post based on a webinar I presented about shared actions.

http://blog.lilybiri.com/invitiation-webinar-shared-actions

Like
2019-08-13 14:53:14
2019-08-13 14:53:14

It would have helped if you did post the advanced action. From your description it looks like you have only on user variable? Can you confirm? You would need a user variable, a Boolean for each of the images. That is completely logical, but will explain fully after you confirmed having only one user variable.

Like
(2)
(1)
>
Lieve Weymeis
's comment
2019-11-04 13:08:51
2019-11-04 13:08:51
>
Lieve Weymeis
's comment

Sorry for my late response! I’ve been busy with other stuff

Yeah, Lieve, you are right, I only designed one variable (“clickendlessly”) and reused it in each advanced action for each image (that I want to change color) separately.

The AA looks like this:

IF

Perform actions: If * All conditions are true

Clickendlessly * is equal to * 0

ACTIONS

Change state of * “Image” * To * Normal

Toggle * Clickendlessly

ELSE

Change state of * “Image” * To * Clicked

Toggle * Clickendlessly

I hope it’s clear. Not sure what exactly to do with that now… (I’m so new to Captivate! )

Like
Add Comment