1 Reply Latest reply on Jun 29, 2006 4:18 AM by ricklecoat

    Buttons only respond once

    ricklecoat Level 1
      I've got a half dozen buttons (all instances of the same symbol). I had them working fine except that they lacked that 'locked' state -- you know, where the button remains in an 'over' or otherwise highlighted state to show the use which part of the site they are in. So I added some code to sort that out, using the 'button_mc.gotoAndStop("activeStateKeyframe")' technique. I also included some code intended to record the button that had been clicked as a variable, pass that info into the function as part of the above Goto target path, and then reuse the variable to determine which buttons had NOT been clicked and set their states back to the default 'off' state.

      Each button calls two functions; the first one deals with other stuff and works perfectly; the second is the that described above. With just the first function in place, all was well. However, once I introduced the second function, called lockButton, the buttons would behave exactly as intended on the first click but then would not respond to subsequent mouse clicks. It's definitely the second function that is giving the problems because if I remove it from the sequence (the end of the first function contains a call to the second, in a daisy-chain sort of way) the buttons respond normally again -- albeit without the required "You are here" state.

      I'll attach the relevant code to see if anyone can help; my apologies for what is bound to be awful, inefficient code, but I'm really new to this (typed my first line of Actionscript 4 days ago). Anyway, here's the code. I've included the first function for completeness, as that is the one that the buttons call directly.

      Thanks in advance for any help you can offer an AS newbie.

        • 1. Re: Buttons only respond once
          ricklecoat Level 1
          ::bump::

          I know it looks like a huge slab of code to look at, but it's really just two functions and the button event handler that calls them.
          If anybody has any insight into this problem I'd really appreciate it, because it's holding up the rest of the project.

          Many thanks in advance;