Skip to main content
Inspiring
February 16, 2022
Answered

Nested Symbols - Control movement through JavaScript

  • February 16, 2022
  • 1 reply
  • 241 views

I have a graphic symbol nested inside another graphic symbol. 

 

The parent symbol has movement controlled via JavaScipt on button press on the main timeline.  I want to do the same for the nested symbol.  How would I do that?

    This topic has been closed for replies.
    Correct answer FlatChat

    Worked it out...

    1 reply

    FlatChatAuthor
    Inspiring
    February 16, 2022


    At the moment I have this code on the main timeline.

     

    The symbol RFLensHolder is not rotating. However, if I change that code to a diferent graphic symbol which is not nested, that symbol rotates. It appears to be an issue with controlling nested symbols.  

     

        //Right Frame Rotate CW Buttons
        this.ButtonRotateCWRightFrame.addEventListener("mousedown", RF_RotateCW_Down.bind(this));
        
        this.ButtonRotateCWRightFrame.addEventListener("pressup", RF_RotateCW_Up.bind(this));
        
        this.ButtonRotateCCWRightFrame.addEventListener("mousedown", RF_RotateCCW_Down.bind(this));
        
        this.ButtonRotateCCWRightFrame.addEventListener("pressup", RF_RotateCCW_Up.bind(this));
        
        
        //Right Frame Rotate CW Buttons functions to move Rotate Frame CW
        function RF_RotateCW_Down() {
        createjs.Ticker.addEventListener("tick",updateRF_RotateCW);
        }
        
        function RF_RotateCW_Up() {
        createjs.Ticker.removeEventListener("tick",updateRF_RotateCW);
        }
        
        function updateRF_RotateCW(){
        
         var angle = 1/Math.PI;
          root.RFLensHolder.rotation += angle;
        }

     

    FlatChatAuthorCorrect answer
    Inspiring
    February 23, 2022

    Worked it out...