1 Reply Latest reply on Nov 12, 2013 4:09 PM by bdggr

    the order of symbols returned by getSymbols?

    bdggr

      It seems that the order of symbols that I get back from sym.getComposition().getSymbols("symbolname") doesn't correspond to the order they were created or their order in the Elements table or their order in the timeline list.  What determines their order in the array?  How can I sort based on y position on stage or order of creation?

        • 1. Re: the order of symbols returned by getSymbols?
          bdggr Level 1

          I worked out a way to sort by position on the stage from upper left to lower right:

           

          symbols.sort(function(a, b) {

                    var aOffset = a.getSymbolElement().offset();

                    var bOffset = b.getSymbolElement().offset();

             return aOffset.top + aOffset.left - bOffset.top - bOffset.left;

          });

          1 person found this helpful