Multiple 'Change State' triggers on 1 item

I was helping someone else in another thread who wanted to detect CTRL + Click to simulate selecting multiple items in a list (like selecting multiple files from a list in windows).

I came up with a solution by setting a variable with an initial value of False. Then using JavaScript to detect when the CTRL key was down and change the variable to True, and when released change it back to False.

This worked and changes the state of the button only when CTRL + Click are used. The trigger on the menu item was:

Change the state of Rectangle 1 to 'ctrl-pressed' when user clicks if 'keypress' is equal to True

But wanting to take this a little further I want to be able to CTRL + Click the same item and return it back to normal.

To do this I thought I could set 2 triggers on the 1 item. The first trigger is:

Change the state of Rectangle 1 to 'ctrl-pressed' when user clicks - if 'keypress' is equal to True AND Rectangle 1's STATE is equal to 'Normal'

This trigger works fine when it is the only trigger on the item. But if I add the second trigger:

Change the state of Rectangle 1 to 'Normal' when user clicks -  if 'keypress' is equal to True AND Rectangle 1's STATE is equal to 'ctrl-pressed'.

When I add this trigger than nothing works.

You can have a look here.

Menu item 1 has both triggers applied.

Menu items 2, 3, 4 only have 1 trigger applied.

 

10 Replies
Gary Collins

Ashley,

I don't think it is the javascript that is causing the problem though as the triggers that are causing the issue don't rely on the JS code. They are just checking the status of a variable and state of an object.

The issue is having two change state triggers on 1 object which I think is confusing storyline.

Although I thought it would work because if the conditions in 1 trigger isn't met than it would move to the next trigger, but apparently it doesn't.

Here is a simpler version of what I am talking about.

 

Gary Collins

Because I want to change it based on the value of a variable, the 'Visited' state won't work I don't think.

I thought of the second option of hiding an object and then showing the other, and I think maybe the only way to do this.

Was hoping to do it without adding more objects on the timeline but I don't think that is possible. 

David Cosman

Cary Glenn's example helped me come up with a solution for a problem I had: hiding and showing an object when the user clicks on another shape. Here is the URL

https://owl.uwo.ca/x/dZqhRP

I created a pie shape to test it. Instead of Visited, I used the Selected state instead. This are the triggers I used:

Note that the order is important. I also attached the Story file.