What if you take the sym.stop(); at the end out?
It looks like you are telling it to add to the count, play the loop, and then stop. I would put the stop command outside of the loop. Maybe just one frame beyond the looping section.
Taking sym.stop() off of the end does solve one of your problems, so you do need to do this, but there are two other issues here.
1) Your variables are incorrectly swapped in the if statement.
Right now, it says: sym.setVariable("countNum", ++counter);
It should say: sym.setVariable("counter", ++countNum);
2) Your if statement will always be true, because you are setting counter to 0 during each loop. This means the animation will play infinitely, not just 6 times.
You would need to move the sym.setVariable("counter", 0); to a point in time before the beginning of the loop. For example, in new trigger at 0ms.
Thank you for your advises.
It nearly works. Only the count doesn't work, it loops endlessly...
1 person found this helpful
Right. You also need to move where you are setting the "counter" variable in order to avoid this. (See my point #2 above.)
Here's a very simplistic example: http://thetraininggrounds.com/An-test/6-loop/Untitled-1.html
And here's the project I used to create it, so you can see where I put the various pieces of code: http://thetraininggrounds.com/An-test/6-loop/6-loop.zip
Now it works. I found the mistake in my script...
Good work - thank you very much!
This old post from 2012 helped me through my beginners problems - thanks!
I am creating web banners to put on eg. Google where the banners must stop animate after X seconds, that's why your solution helped.
After the looping stops (after eg. 2 loops) I need the banner to jump to a "end message", eg. Book today! - how can I do that?
Hoping for a quick reply - Thanks!