Hello!
I have worked on several projects in Edge Animate using the below code for setting a condition where something happens only if 2 or more buttons are clicked (in any order).
In the stage I would have add:
sym.myButton1 = 0;
sym.myButton2 = 0;
sym.buttonsAllClicked = false;
sym.totalCheckAll = function () {
if (sym.buttonsAllClicked == false) {
if (sym.myButton1 > 0 && sym.myButton2 > 0
) {
sym.buttonsAllClicked = true;
sym.$(“Something”).show();
}
}
}
And on click of each button I would have added:
sym.getComposition().getStage().myButton1 += 1;
sym.getComposition().getStage().totalCheckAll();
My question is how to implement this in Hype? I can load the code at the start in a script that runs on page load, but am not sure how to change the “getStage” code for each button.
Hi DBear,
Thanks for your help above for only displaying an element if certain buttons were all clicked. Now I have another question I am hoping to get some help with. Using the same code above for scene load and button click, I would like something to display if a button is NOT clicked. this is what I have tried but without luck:
Your first set of code is fine but you have an error in the conditional statement.
if (something is equal to something else) {
do something
}
Would be written
if (myButton1 == 0){
element.style.display = "inline";
}
Also, by adding an @ symbol in front of any users name. We would get notified. Just an FYI
@JimScott he kinda mentions the context in his post. He would have buttons that increase the integer and another that calls the function
Also @Babs, your second code logic seems fine but we wouldn’t know why it’s not working without seeing it in action as there is likely something else that is causing the problem