3 Replies Latest reply on Feb 18, 2015 1:25 PM by T. Ganoe

    Get a symbol follow another element's position




      I would like to do something pretty simple, via the code.


      I have a symbol. Inside this symbol I have a simple rectangle, which is animated on the Y position (so basically just an "up and down" loop animation).


      On the stage, I also have another symbol, and I want this one to follow the Y position of the rectangle inside the first symbol.


      So basically: my 1st symbol don't move, but the rectangle inside of it does, and I want the 2nd symbol to move as the rectangle.


      Is it possible? I really don't know where to put this code, and which code to use...



        • 1. Re: Get a symbol follow another element's position
          T. Ganoe Level 1

          One symbol (the rectangle) is the leader, when it moves, the outside symbol follows.


          What causes the leader to move?  Does the user click on it or is there a script somewhere causing it to move.


          Find that function or user event and add script to make the follower move.


          If that doesn't help, tell me the names of your symbols and what causes the movement and I'll write it for you.

          1 person found this helpful
          • 2. Re: Get a symbol follow another element's position
            Keysaw Level 1

            Thank you for your answer!


            Right now what makes the leader moving is a simple loop animation inside the symbol (not in the main timeline), just up/down movement. Is it different if the movement is causes by the code?


            Actually I want it to be practical, which means that I could change the movement of the leader if I want to, the follower will follow anyway. I don't think I would move the leader by code but I may so... If this is an important point I should decide now I guess!


            I'm not really a coder... So if you have some time to write something for me, I would really appreciate it!


            Let's say my first symbol is called crow_01 (leader), my second is called crow_02 (follower), and the movement is done by symbol's timeline animation (let's put the movement by code aside for now).


            Thank you very much!

            • 3. Re: Get a symbol follow another element's position
              T. Ganoe Level 1

              HI..sorry it took so long to answer.  I hope you got your animation working.  If you are running it on the timeline, why not just select both objects and "group" them together.  Then they will stay together perfectly.  Otherwise you're going to have to add some more functions.