7 Replies Latest reply on Oct 5, 2013 12:37 PM by kglad

    enabling/disabling function

    Ron Colmen Level 2

      I'm using the below code to display 'help tips'. Now I want to use a buttton to enable / disable tipS()

       

      I tried using an IF condition within to tipS, but failed. How can I achieve the enabling/disabling?

       

      function tipS(tagTarget, helpTips) {

                tagTarget.onRollOver = function() {

                          h = _root.createEmptyMovieClip("h", 5);

                          h.attachMovie("tipBox", "tipBox", 10);

                          //other stuff - x,y, autoSize,backgroundColor,etc...

                          h.tipBox.message.text = helpTips;

       

                          h.onMouseMove = function() {

                                    //x & y

                          }

                }

                tagTarget.onRollOut = function() {

                          removeMovieClip(h);

                }

      }

      tipS(mc, "text");

        • 1. Re: enabling/disabling function
          kglad Adobe Community Professional & MVP

          var tipsOn:Boolean;

           

           

          function tipS(tagTarget, helpTips) {

          if(tipsOn){

                    tagTarget.onRollOver = function() {

                              h = _root.createEmptyMovieClip("h", 5);

                              h.attachMovie("tipBox", "tipBox", 10);

                              //other stuff - x,y, autoSize,backgroundColor,etc...

                              h.tipBox.message.text = helpTips;

           

                              h.onMouseMove = function() {

                                        //x & y

                              }

                    }

                    tagTarget.onRollOut = function() {

                              removeMovieClip(h);

                    }

          } else {

          delete tagTarget.onRollOver;

          delete tagTarget.onRollOut;

          }

          }

          tipS(mc, "text");

          1 person found this helpful
          • 2. Re: enabling/disabling function
            Ron Colmen Level 2

            Thanks. I did this - did not work?

             

            tips_btn.onRelease = function(){

                      tipsOn = !tipsOn;

                      //trace (tipsOn)

            }

            • 3. Re: enabling/disabling function
              kglad Adobe Community Professional & MVP

              that will work to toggle tipsOn as long as you used that first line of code i suggested:

               

              var tipsOn:Boolean;

              • 4. Re: enabling/disabling function
                Ron Colmen Level 2

                Yes, I have included that. But does not wok.

                 

                var tipsOn:Boolean;

                tips_btn.onRelease = function(){

                          tipsOn =!tipsOn;

                          //trace (tipsOn)

                }

                 

                function dyoTip(tagTarget, helpTips) {

                          if(tipsOn){

                          tagTarget.onRollOver = function() {

                                    h = _root.createEmptyMovieClip("h", 5);

                                    h.attachMovie("toolTip_MC", "toolTip_MC", 10);

                                    h.toolTip_MC.message.text = helpTips;

                 

                          }

                          tagTarget.onRollOut = function() {

                                    removeMovieClip(h);

                          }

                } else {

                delete tagTarget.onRollOver;

                delete tagTarget.onRollOut;

                }

                }

                 

                dyoTip(a_mc, "test A");

                • 5. Re: enabling/disabling function
                  kglad Adobe Community Professional & MVP

                  use:

                   

                  tips_btn.onRelease = function() {

                      tipsOn = !tipsOn;

                      dyoTip(a_mc,"test A");

                  };

                  • 6. Re: enabling/disabling function
                    Ron Colmen Level 2

                    Thanks Kglad.

                    • 7. Re: enabling/disabling function
                      kglad Adobe Community Professional & MVP

                      you're welcome.