Copy link to clipboard
Copied
Hello I'm starting to work with Animate and I'm having problems using the if and else conditions. I have a button that clicks it to check the status of my movieclips depending on the situation the action takes
_this.bt_Verifica.on('click', function () {
if (_this.mcUm.currentFrame == 1 && _this.mcDois.currentFrame == 1 && _this.mcCinco.currentFrame == 1 && _this.mcSete.currentFrame == 1) {
_this.gotAndStop(11);
} else {
_this.gotAndStop(12);
});
I'm learning now to mess with it, sorry if I'm asking a very stupid question;
I think I'm getting the idea.
Your if statement should work if these four buttons are selected but it will also work if five or more are selected.
Also, now that I realized that there's a typo in your code.
It should be
_this.gotoAndStop
and not
_this.gotAndStop
Please let us know.
Regards,
JC
Copy link to clipboard
Copied
Hi.
When you check if the current frame is 1, are you trying to find out if it is the first frame?
Because if so, keep in mind that in HTML5 Canvas documents the first frame is 0.
Can you check this out?
Regards,
JC
Copy link to clipboard
Copied
there are seven buttons that enable movieclips and then I have a button that checks if the person clicked on the correct ones. For example: the correct order is 1, 2, 5 and 7. If the person clicks on these and activates the play of the movieclip this is correct. And go to screen X, if you didn't click on those to screen Y.
Copy link to clipboard
Copied
I think I'm getting the idea.
Your if statement should work if these four buttons are selected but it will also work if five or more are selected.
Also, now that I realized that there's a typo in your code.
It should be
_this.gotoAndStop
and not
_this.gotAndStop
Please let us know.
Regards,
JC
Copy link to clipboard
Copied
Oops it worked, there was a letter missing in the code, thank you very much João César!
Copy link to clipboard
Copied
You're welcome!