I am a graphic designer and rudimentary coder at best, so I apologize in advance if this should be a no brainer.
My goal is to display random repeating tile patterns that overlap. The original files are .png format with transparency. I wish to show how they fit within a pattern building system that allows for multiple combination options.
To keep file sizes down, I tiled each of the small png files to fill my stage and converted them to symbols. They fall into two symbol groups: Pos and Neg with a number sequence after.
What I'd like to do is have one Pos and one Neg display and change randomly on a loop. With the hundreds of different symbols, this would show a massive amount of possible combos.
I searched for a solution and the best I could find was this: "Call random symbol" https://forums.adobe.com/thread/1110407?start=0&tstart=0http://
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");
myAni.appendTo(stage);
________
This seems like a good starting point. I tried it almost as is by adding the code to compositionready for my Stage. I changed "Symbol_" to "Neg" and it didn't show anything in the browser. As such I have a few questions:
1. This solution appends the Stage. I eventually need to place two random symbols. Should I be targeting something like place-keeper rectangles vs. the Stage?
2. The Math.random()*6: I'm guessing the 6 is replaced with the number of symbols in each category and the +1 is because 0 could be generated? Does that also mean that the total of 6 should be one less than the entire total?
3. When naming a symbol library that goes into double or triple digits, for coding purposes do you leave off the zeros in Neg01 or Neg001?
4. And finally, is there a better or easier solution than this for what I want to do?
Thank you, Michael