I have a symbol which displays 3 different images in a given time. I need to make such buttons that when clicked, one will loop the animation once, the other 3 times and the next 8 times.
I think I somehow need to send a parameter to the symbol but I could not figure out how.
Any ideas?
A simple way to "send parameters to a symbol" is to set a variable to its instance.
Lets say your symbol called mySymbol is inside the stage.
Button1 clicked:
stage.getSymbol("mySymbol").setVariable("repeat",1);
Button2 clicked:
stage.getSymbol("mySymbol").setVariable("repeat",3);
Button3 clicked:
stage.getSymbol("mySymbol").setVariable("repeat",8);
Then in your symbol animation you put a trigger on the end like this one:
Animation ends trigger:
var repeat = sym.getVariable("repeat");
if(repeat > 0){
sym.setVariable("repeat", repeat - 1);
sym.play("animation_start");
}else{
sym.stop();
}