1 Reply Latest reply on Mar 31, 2014 12:27 PM by resdesign

    More actions to one button

    Octopus67 Level 1

      I want to make a pause/play button, shifting between the two symbols by clicking.

       

      Does anybody know how to implement pictures instead of

      the on/off html-text on the button, according to following code from Marie Goodwyn captured from her site:

      http://www.edgehero.com/articles/interactivity

       

       

       

       

       

      //******************************** Demo for toggle button ******************

      //                                    with setVariable.                    * 

      //                              by Marie Goodwyn for edgeHero              *

      //**************************************************************************

       

       

      //set the value of a Symbol variable

      sym.setVariable("onOff", true);

      // click event

      sym.$('btn').click(function(){

                // get the variable

                var onOff = sym.getVariable("onOff");

                if (onOff == true) {

                   sym.$('Ellipse').css({'background-color':'green'});

                          sym.$('btnLabel').html('Off');

                          // reset the variable to false for next click

                          sym.setVariable("onOff", false);

                }

                else {

                          sym.$('Ellipse').css({'background-color':'red'});

                          sym.$('btnLabel').html('On');

                          // reset the variable to false for next click

                          sym.setVariable("onOff", true);

                }

      });