Hi. I have a text box where the user is supposed to enter the number 68, and then I want that specific number to trigger the opening of a new layer without having to enter any other key such as ENTER. The number itself should trigger the layer. Is this possible? I'm assuming I would need some JavaScript maybe? Thank you.
Put this code in 'Execute Javascript when the timeline starts on this slide' trigger. The blur() method will remove keyboard focus from the current element. Create a trigger in SL to say: Show layer 'correct' when 'NumericEntry' changes if 'NumericEntry' = value 68. As soon as you type 68 into the input field another layer will show up.
7 Replies
I think you could use a bit help of Javascript. Something like this:
const textFields = document.querySelectorAll('.acc-textinput');
textFields.forEach((textField) => {
textField.addEventListener('keyup', () => {
textField.blur();
});
});
Put this code in 'Execute Javascript when the timeline starts on this slide' trigger.
The blur() method will remove keyboard focus from the current element. Create a trigger in SL to say: Show layer 'correct' when 'NumericEntry' changes if 'NumericEntry' = value 68. As soon as you type 68 into the input field another layer will show up.
I have a file that does something similar could be easily be repurposed
This post was removed by the author
I'll give it a try. Thank you!
I'm having trouble opening this file for some reason. It could be something on my end I suppose. I will keep trying. Thanks for responding!
You may need to update to the latest version
I got it to work. It's perfect. Thank you!
It uses the similar code that Nedim posted, I just had this lying around from something else.
Sent from my iPhone