2 Replies Latest reply on Jun 29, 2013 12:53 PM by jbowden

    Reusing symbols



      Ive made a symbol call "pic" that moves acoss the screen.

      and have a Click


      var mySymbolObject = sym.getSymbol("pic").play();

      on an button shaped element.


      When I click the element it works fine.


      Now if I drag another "pic" symbol on to the stage, I would expect them both to move when clicked, but only the original moves.


      and if I delete the original and drag a fresh "pic" symbol on the stage It still does not work.


      Its like the sym.getSymbol can only link to the original symbol and if you delete it (from the stage) it does not link to any new one you drag to the stage?


      Any help or explanation to this would be great




        • 1. Re: Reusing symbols
          mrshiney Level 1

          I think Ive worked it out

          you have the name the element.

          when I draged a new symbol on to the stage it named it pic_1

          and I was still tageting the old one

          var mySymbolObject = sym.getSymbol("pic").play();

          • 2. Re: Reusing symbols
            jbowden Adobe Employee

            Yes, that's indeed how it works. When you use getSymbol, you're not getting every symbol instance made from that symbol - just the one that you've targeted (such as your "pic" symbol).


            However, everything inside the symbol you create (including other symbols) does come along when you add a symbol instance to the Stage. So for instance, if the pic symbol was inside a symbol and you called it from inside the same symbol (not from the symbol instance on Stage, but a child element or symbol within the symbol), then you wouldn't need to modify your code at all - it would just work, as all the addressing is relative to the parent symbol.

            1 person found this helpful