Multiple 'Change State' triggers on 1 item

May 26, 2015

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.

 

9 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. 

This discussion is closed. You can start a new discussion or contact Articulate Support.