Conditional statements


Is there a way to write the script better (new to JS and Hype)

Ok, I have 3 buttons ( on main timeline) that move content onto the stage when click.

Buttons Timeline animation with slides in content
Pin_1 ------> slide_in_1
Pin_2 ------> slide_in_2
Pin_3 ------> slide_in_3

I have added a actions to the button with the mouseclick option, the first action starts the corresponding slide_in_ animation that moves the content on stage.
I have also added a 2nd mouse click action but this time selected Javascript, this script checks the time position of the other slide_in_ to see if they are on stage ( 0.5 is the end of the animation), and if they are , it plays their timeline in reverse (basically sliding them off stage)

So this is the code and it works , however my project will have 14 buttons and 14 slides to slide in and out, as as you can see for the mess below it’s only gogin to get more messy :-/ is there a way to put the slides in an Array and put the Array in the hypeDocument.currentTimeInTimelineNamed(‘Array’)

var slidePosition_2 = hypeDocument.currentTimeInTimelineNamed('slide_in_2')
var slidePosition_3 = hypeDocument.currentTimeInTimelineNamed('slide_in_3')

if ((slidePosition_3 = 0.5) || (slidePosition_2 = 0.5)); {

hypeDocument.continueTimelineNamed('slide_in_3', hypeDocument.kDirectionReverse, false);
hypeDocument.continueTimelineNamed('slide_in_2', hypeDocument.kDirectionReverse, false);

Any help or suggestions would be very much appreciated