12 Replies Latest reply on Feb 25, 2015 5:32 AM by resdesign

    Having trouble with a custom toggle button

    Seruhio

      Hey guys i made a nice looking menu but I can't seem to finish the code properly. Basically what I want the button to do is:


      Click button once: Menu shows up and button changes form.


      Click it again: Menu disappears and the button goes back to its original form. Doing this with a playReverse(); on the menu and the button.


      Both the button and the menu have a nice animation. I can make both show and hide animations on the button and the menu work at the same time perfectly. But I don't know how to make the button toggle like it should.


      The button and the menu are symbols with their own timelines.


      The code in my button is something like this:


      Show:

      var mySymbolObject = sym.getSymbol("menu");

      mySymbolObject.play();

      var mySymbolObject = sym.getSymbol("button");

      mySymbolObject.play();

       

      Hide:

      var mySymbolObject = sym.getSymbol("menu");

      mySymbolObject.playReverse();

      var mySymbolObject = sym.getSymbol("button");

      mySymbolObject.playReverse();