Duel controls from a shape? (SL2)

Jun 05, 2017

Is it possible to make this work? I have a shape that I want to play and pause some audio. The control shape has a paused and playing state that are transparent to cover part of an image underneath. It starts in the paused state and is supposed to change to playing when clicked while paused and vice versa with the audio playing if state is paused and pause if state is playing. Seems simple enough. I can get it to play fine but it won't pause. The trigger order should do the button first then the audio. See my triggers below. Has anyone got something like this to work?

5 Replies
Walt Hamilton

You can save a lot of trouble and time by naming your states Normal and Selected. That setup  causes the built-in triggers to toggle between the two states without the need for you to write your own triggers.

As Russell's sample shows, you need a third objective player to make this party work. If you try to do it depending on the states, and the triggers change both the states and the action depending on the states, only one direction will work: You click and if it is playing, it stops. Then the next trigger makes it play, if it isn't, which of course, it always is. The explanation is that all triggers are always evaluated. (If you're a programmer, there is no "else".)  You can check this out by noticing that whatever state the rectangle (an media) is, the trigger changes both. Also, if you change the order of the triggers (switch the order of the two change states and the two plays, and you will find that now it pauses, but won't play.

Russell's sample works because he has an un-involved third party (the variable) which is only changed once. Then everything else is changed or not depending on the value of the variable. (He also saved time by using a T/F variable which can be changed from one to the other by the toggle action.

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