i am not sure how your composition is but let's assume that you have symbols named symbol_1, symbol_2 etc...
You can append them randomly to the stage as follows and play their timeline.
var myVar = Math.floor((Math.random()*6)+1);
var stage = sym.$("Stage");
var myAni = sym.createChildSymbol("Symbol_" + myVar, "stage");
Thank you so much for the fast reply and demo files! As I suspected, this looks easy enough, I'll integrate it into my comp and let you know how it goes. Thanks Again.
As I suspected the code you gave me worked perfectly, Thanks again!
Wonderful! glad to help!
Hello Resdesign, your example was very useful for me too. But I need an additional action.
I need that at the end of each symbol the animations starts all over again, I mean, load a new symbol randomly...
I tried placing some code at the end of each symbol but it doesnt work, since I think we are not running on the main timeline (stage).
I hope I can explain myself well
Thanks for your help
I am not sure I understand what you want to do. Could you explain further?
Hi, thanks for your answer.
Ok I have 7 short animations (10 to 30 seconds), each one for a different product. Each animation is on a different symbol.
So I used the script that you posted above, and every time the page loads it runs a different animation (or symbol). I used the script exacty as you have it on the same position, at the begining of the stage.
At this moment when the animation ends it re-starts the same animation (if I don't click the refresh button). I need that when an animation ends, the script loads a different symbol randomly. Something like going back to the beginning of the stage and start the whole thing again.
But as I think the animation runs on the "container" I`m not sure how to go back to the stage using code.
Here is my example as it is right now:
I hope I am clear enough !
Thanks for your help.
I believe the reason it is not working is because calling a symbol from another symbol is different from calling it from the main timeline. Let me try to get you a sample file in a few.
Thanks a lot Resdesign !!
Yes it worked, your example does exactly what I need ...
Glad it is working for you.
im still an amature when it comes to coding, so i dont no why but my symbol isnt animating at all, dont know what could be the problem
heres the code
randY = math.floor(math.random()*1200 );
randX = math.floor(math.random()*600);
Your function has randomNumbers, but you call it RandomNumbers later. You should also call Math.floor() and Math.random() instead of math.floor() and math.random() (note the capitalization).
Hope that helps,