Copy link to clipboard
Copied
I'm trying to achieve the following in Captivate 6.0:
I have tried to achieve the Show / Hide by:
Unfortunately, it appears when I jump back to the same slide using JavaScript, the On Enter event is not being called. If I click back then forward on the playbar, I see the desired result.
I have included the JavaScript and Advanced Action (being set On Enter for the slide) below.
Is there a way to:
Here are the details:
Variable (Set through Project --> Variables...)
Dice_Value = -1
Advanced Action (On Enter)
If Dice_Value is greater than or equal to 1
Hide Dice_Animation
Hide Dice_Click_Box
Show Dice_Value_Text
Show Dice_Next
Show Dice_Next_Caption
Else
Show Dice_Animation
Show Dice_Click_Box
Hide Dice_Value_Text
Hide Dice_Next
Hide Dice_Next_Caption
JavaScript (Called when the dice animation is clicked)
function rollTheDice(){
var cpObj = document.Captivate;
var diceValue = 1;
var currentTime = cpObj.cpEIGetValue('cpInfoCurrentTime');
var lastDigit = parseInt(currentTime.charAt(7));
switch(lastDigit) {
case 7:
diceValue = 1;
break;
case 8:
diceValue = 2;
break;
case 9:
diceValue = 4;
break;
case 0:
diceValue = 5;
break;
default:
diceValue = lastDigit;
break;
}
cpObj.cpEISetValue('m_VarHandle.Dice_Value', diceValue);
cpObj.cpEISetValue('cpCmndGotoSlide',cpObj.cpEIGetValue('rdinfoCurrentSlide'));
cpObj.cpEISetValue('rdcmndResume',1);
}
rollTheDice();
If you get back to the first frame of a slide, the advanced action triggered by the On Enter event is not executed. I'm an advanced action user, Javascript is still little bit of a mystery to me. If I want an On Enter action to be repeated, I will get back to the slide before the slide and with a conditional action (slide has already been visited, thus setting a variable and checking that one) get it immediately to the next slide. That way the on enter event is repeated. Did not check it yet, bu
...Copy link to clipboard
Copied
If you get back to the first frame of a slide, the advanced action triggered by the On Enter event is not executed. I'm an advanced action user, Javascript is still little bit of a mystery to me. If I want an On Enter action to be repeated, I will get back to the slide before the slide and with a conditional action (slide has already been visited, thus setting a variable and checking that one) get it immediately to the next slide. That way the on enter event is repeated. Did not check it yet, but perhaps navigating to the frame before the first frame of the present slide will work as well (micro-navigation), something I have to try out because maybe you need to get a couple of frames more backwards.
Lilybiri
Copy link to clipboard
Copied
Thanks Lilybiri!
It was really useful to get your confirmation that 'If you get back to the first frame of a slide, the advanced action triggered by the On Enter event is not executed.' This means I'm not going cRaZy!
It gets a bit complicated as there are a few slides that might navigate to this slide (I'm building a Choose Your Own Adventure). So, there was no clear 'previous' slide to work with. Based on a few blogs (including your own) I have now done it this way:
It works well. Thanks again for your prompt response!
Copy link to clipboard
Copied
You're welcome. I really need to practice Javascript, took a course with code academy but didn't find time to practice;
Lilybiri