Copy link to clipboard
Copied
Hey everyone,
I'm trying to find a way to use random numbers to select images on a slide. I've got the JS working for generating the random numbers and a user defined variable that it's assigned to in Captivate. The issue I'm having is I can't find a way to use that number to show an image on the slide. I tried using multiple tabs on an advanced action, but that didn't work well.
The way it's set up is the JS will execute on slide enter. When the user presses the button on the slide, it will read the random number, pick the appropriate image, and display it. So far, the slide enter code works. It generates the number and assigns it to the User Defined Variable.
When I try creating an advance action with multiple tabs, only the first tab executes. Is there a way to have Captivate run through multiple If/Else scenarios that I'm not seeing? I'm on Captivate 2017 V 10.0.0.192 on a corporate system so I can't upgrade to the latest at the moment. This is the latest approved for our org for now.
Any advice you can provide is greatly appreciated! Thank you.​
Captivate can't do a chain of if-elseif-elseif. You'd have to organize the action in a series of IF tabs without ELSEs
If number == 1
Show image1
If number == 2
Show image2
etc.
You could even make this into a shared action for all of the buttons to use.
Or, do it all in JS since you already have the random function working. Make a function something like
function showImage(){
cp.hide("image1"); //first hide all images if needed
cp.hide("image2");
If (randomNum == 1){
cp.show("image1");
}
else if
...Copy link to clipboard
Copied
Please ignore the Marked Answered. I accidentally clicked the link when I was scrolling on the page. Question is still up for discussion. Still looking for an answer or ideas. Thanks.
Copy link to clipboard
Copied
Captivate can't do a chain of if-elseif-elseif. You'd have to organize the action in a series of IF tabs without ELSEs
If number == 1
Show image1
If number == 2
Show image2
etc.
You could even make this into a shared action for all of the buttons to use.
Or, do it all in JS since you already have the random function working. Make a function something like
function showImage(){
cp.hide("image1"); //first hide all images if needed
cp.hide("image2");
If (randomNum == 1){
cp.show("image1");
}
else if(randomNum == 2){
cp.show("image2");
}
}
Call this function on click of each of your buttons.
Copy link to clipboard
Copied
Thank you Dan. I discovered that myself through trial and error with the multiple tabs in Advanced actions. Wish I had seen your reply before going through that. Lol.
I appreciate the help though!