Is there a way to require the user to hold down the Shift key or Ctrl key while clicking on something in Articulate Storyline? I'm trying to create a simulation of selecting multiple items in a list.
I thought of using the "User Presses a Key" trigger to adjust a variable indicating whether or not Shift/Ctrl is held down. It looks like you can only use Shift/Ctrl in combination with other keys in the Trigger Wizard, however. Any other ideas?
No, I dont think you can get this kind of function to work. CTRL or SHIFT clicking uses 2 functions and storyline doesnt track clicking as a button press. Also there is a good reason to avoid ever using button triggers using these keys as they have functions in every browser which will nullify your interactions.
Well I sort of have this working with javascript but not completely.
I created a button with a normal state and 'ctrl_selected' state.
I also have a variable called 'keypress' initially set to 'false'
I add a trigger to the button to change the state to 'ctrl_selected' if keypress equals true.
Then I add a slide trigger that executes javascript when the timeline starts.
JAVASCRIPT
var player = GetPlayer();
player.addEventListener("keydown", function(event) { if (event.ctrlKey ) player.SetVar("keypress",true); });
player.addEventListener("keyup", function(event) { if (event.ctrlKey ) player.SetVar("keypress",false); });
This will detect the ctrl key down and change the variable to true so that when the user clicks the button the state will change.
I also want to be able to detect the keyup event so that when they release the ctrl key it will return back to false otherwise they can click more buttons without holding the ctrl key because the variable will be true.
The problem I am having is the keyup function is not being detected.
I am not a javascript expert but this is what I came up with so far when googling javascript.
I will keep trying but hopefully someone else can help out with this to get the keyup event to work.
Also if you don't have a web server to upload the content to, you could look at using Tempshare.articulate.com which is a free testing platform and the link will stay live for 10 days. Also, you could look at using Amazon S3 as a hosting platform as it does have generous usage limits at a low cost. This article described here how to upload and use Amazon S3.
Hello. This is kinda old topic, but I have found it searching through the internet. I need the CTRL function in a software simulation I am currently working on, so these two links are not working. I would really like to see the solution. Thanks
This thread has just helped me out immensely. I have a 'Try it' type module where progression to the next slide in the software simulation is a trigger and Marko's solution works perfectly there.
The test module though, needs questions rather than triggers as it feeds into a results slide. I want to use the same principle to force users to SHIFT + click (highlight all in a list) but there is no trigger to link the variable to. Any ideas?
20 Replies
No, I dont think you can get this kind of function to work. CTRL or SHIFT clicking uses 2 functions and storyline doesnt track clicking as a button press. Also there is a good reason to avoid ever using button triggers using these keys as they have functions in every browser which will nullify your interactions.
Well I sort of have this working with javascript but not completely.
I created a button with a normal state and 'ctrl_selected' state.
I also have a variable called 'keypress' initially set to 'false'
I add a trigger to the button to change the state to 'ctrl_selected' if keypress equals true.
Then I add a slide trigger that executes javascript when the timeline starts.
JAVASCRIPT
This will detect the ctrl key down and change the variable to true so that when the user clicks the button the state will change.
I also want to be able to detect the keyup event so that when they release the ctrl key it will return back to false otherwise they can click more buttons without holding the ctrl key because the variable will be true.
The problem I am having is the keyup function is not being detected.
I am not a javascript expert but this is what I came up with so far when googling javascript.
I will keep trying but hopefully someone else can help out with this to get the keyup event to work.
View online here.
Tried again when I got home.
Updated the file and it works correctly now. Only thing I still need to figure out is how to deselect the button when clicked again.
Hope this helps.
Awesome! I will test it this weekend. Thanks so much.
Carol,
I have updated the file so you can now select and deselect the items.
You can view it here.
And download the source here.
I was just now able to test this solution. It appears to work great in the HTML5 output, but doesn't respond in the swf version. Hm...
Carol,
That is strange. I am not a javascript expert so hoping someone else will chime in to let us know why this wouldn't work in the swf version.
To detect Ctrl you need press the left mouse button outside the flash player.
Hi
I downloaded the source file version 3 but it is not working.
Anybody help?
Are you testing this locally (on your harddrive)? If yes, then the JS might be blocked by your browser. Upload to some server and test again.
Yes I am testing on my hard drive. My browser ask if I allow to enable active control and scripts, and I answer allow.
But it is not working! I don't have server at the moment!
Well, I downloaded the file, published and tested, it works for me. Have you tried the HTML5 version (story_html5.html)?
Unsupported Browser
The HTML5 player does not currently support this web browser.
Click here to view this project using the standard Flash player.
This is the message when I try to open HTML5
Towards the bottom of this page here see the supported browsers.
Hi
unfortunately nothing.
Could you connect via teamviewer?
Thanks in advance for your help
It is ok now, but to detect Ctrl you need press the left mouse button outside the flash player.
Can we avoid that?
Hi Christodoulos,
Also if you don't have a web server to upload the content to, you could look at using Tempshare.articulate.com which is a free testing platform and the link will stay live for 10 days. Also, you could look at using Amazon S3 as a hosting platform as it does have generous usage limits at a low cost. This article described here how to upload and use Amazon S3.
This post was removed by the author
This post was removed by the author
Hello. This is kinda old topic, but I have found it searching through the internet. I need the CTRL function in a software simulation I am currently working on, so these two links are not working. I would really like to see the solution. Thanks
Hello, me again. Just to let you know that I have finally found a solution for this problem. I am not sure did the quoted links in my post above had the same solution, but here are the links to the solution I came up with:
LinkedIn Article: https://www.linkedin.com/pulse/ctrl-click-select-many-shift-trigger-software-marko-stojkovski?published=t
My webpage post: http://www.enaspot.com/?portfolio=ctrl-click-trigger-select-many-in-software-simulation
This thread has just helped me out immensely. I have a 'Try it' type module where progression to the next slide in the software simulation is a trigger and Marko's solution works perfectly there.
The test module though, needs questions rather than triggers as it feeds into a results slide. I want to use the same principle to force users to SHIFT + click (highlight all in a list) but there is no trigger to link the variable to. Any ideas?
This discussion is closed. You can start a new discussion or contact Articulate Support.