2 Replies Latest reply on Nov 27, 2014 5:46 PM by freddiy

    If statement with variables working across different actions.

    freddiy

      Hey, I was wondering if I could ask you guys/gals a few questions concerning Edge Animate. I uploaded this picture to make it easier to explain:

      http://oi61.tinypic.com/v2zh8j.jpg

       

      So, atm when I mouseover "portfolio" I play a symbol that moves the three papers "out" so to say (sym.getSymbol("moportfolio").play(0);). These 3 papers are 3 different elements but they are in the same symbol.

       

      On mouseout it stops the symbol so all 3 papers "vanish" (sym.getSymbol("moportfolio").stop(0);).

       

      On click "portfolio"  I want to hide the blue paper and disable the mouseout action mentioned above (so they don't vanish, only blue will "vanish").

       

      I was thinking of doing a if statement, but I can't get it to work at all. Where do I define the variable (in click action?) and how do i get the value from the variable to the other action (mouseout)?

       

      This is how I'd like to solve it...
      ------------------------------------------------

      Click:

      sym.getComposition().getStage().getSymbol("moportfolio").$("projectblue").hide();       <--- hides the blue one

       

      var disableactionportfolio = true;                                                                                           <--- set it to true on click

      ----------------------------------------------

      Mouseout:

      if (disableactionportfolio= true;) {

                                                                                                                                               <--- does nothing, red and yellow stay out while blue vanished

      } else {

      sym.getSymbol("moportfolio").stop(0); <--- makes the papers go "back in"

      }

       

      It would be even more awesome if I could make them rewind (go back in instead of vanishing)

       

      Cheers!

        • 1. Re: If statement with variables working across different actions.
          vivekuma Adobe Employee

          You can get/set such variable like below:

              sym.getVariable("disableactionportfolio") and sym.setVariable("disableactionportfolio", true)

           

          So , code will look as:

          Click:

          sym.getComposition().getStage().getSymbol("moportfolio").$("projectblue").hide();

          sym.setVariable("disableactionportfolio", true);


          Mouseout:

          if (sym.getVariable("disableactionportfolio")) {

                                                                                                                                                   <--- does nothing, red and yellow stay out while blue vanished

          } else {

          sym.getSymbol("moportfolio").stop(0); <--- makes the papers go "back in"

          }

           

           

          hth,

          Vivekuma

          • 2. Re: If statement with variables working across different actions.
            freddiy Level 1

            Thanks a lot! I really mean it, I've learned so much from these forums!