1 Reply Latest reply on May 22, 2014 3:35 AM by Sudeshnasarkar27

    Read default position from JSON

    n3ssi3

      Hi

       

      In an onClick-Event I move my elements outside the viewport. Now If I click again, I want them to come back in.

      Is there a posibility to read the default position from the myproject_edge.js ? Or is there even an easier way?

       

      Thanks for the help

        • 1. Re: Read default position from JSON
          Sudeshnasarkar27 Adobe Employee

          Hi ,

           

          You could have the default position of the target element in say 2 variables , valuex and valuey in the stage composition ready -

          var left = sym.$("Rectangle").css("left");

          var top = sym.$("Rectangle").css("top");

          sym.setVariable("valuex", left);

          sym.setVariable("valuey", top);

           

          Now when the first button to move the object offstage is clicked, it say modifies just the x position as -

          sym.$("Rectangle").css( "left", -100);

          On clicking the button to bring back the target element back to its original position you could add this snippet -

          sym.$("Rectangle").css( "left", sym.getVariable("valuex"));

           

          Attaching a sample file also for reference.

           

          Thanks and Regards,

          Sudeshna Sarkar