4 Replies Latest reply on Jun 22, 2008 8:48 AM by clbeech

    problem with function (this)...

    ibrubru Level 1
      Hi I wrote a function to add a drop shadow to a existing button by duplicating the button and move it a bit but it only works on the first one, but I need it to duplicate the effect on any button that i assign that function code. please help.
        • 1. Re: problem with function (this)...
          rlc5611 Level 1
          I don't see any problem with the use of "this". duplicateMovieClip syntax is off a bit and obj+1 returns NaN. I'm also not convinced you aren't going to have a depth conflict somewhere along the way.
          • 2. Re: problem with function (this)...
            clbeech Level 3
            yeah rlc5611 - i agree, ibrubru you'd need to change the second param to a string as in: "obj"+1 - but I'm fairly sure rlc5611 is correct that you will run into depth issues using this type of method.

            also it seems like an 'odd' way to create a drop shadow? how about:
            • 3. Re: problem with function (this)...
              ibrubru Level 1
              thanks guys, i removed the swapdepth line and it worked.

              Clbeech, is there a way to remove the dropshadow filter after another btn is clicked? I have two btns serves like a sub menu, when btn1 is clicked, then the dropshadow effect is applied, and when btn2 is clicked, while dropshadow is on btn2, btn1's shadow effect should be gone. How do you do this?
              • 4. problem with function (this)...
                clbeech Level 3
                np - create an array of all of the button instance names, then within the method use a FOR loop to iterate through all of the buttons that are not the instance being clicked and set the 'filters' prop to null - in fact you could also use the array to add the method to all button instances - like this: