1 Reply Latest reply on Aug 22, 2008 9:44 AM by ensamblador

    quickly clicking on a button

    2x54rt
      I want to set a button up so it is activated and it's function runs completely before it can be activated again. I have tried a ton of things, but I can't get it to survive multiple clicks. The swf does everything great so long as I click slowly but kids are going to use this and they will be clicking like crazy. I need a very basic example of how to set up and event listener and it's associated function such that the FLV player associated with it can change it's source and be ready to play the new source file before the source can be changed again by the next button click or better still only one button click is allowed until everything is ready to play and any other button clicks are disreguarded.
        • 1. quickly clicking on a button
          ensamblador Level 1
          Well if you use "on mouseUp" you can achieve that by adding a global, for example called gBusy

          Button Bhv:
          ---------------------------------

          global gBusy

          on beginSprite me
          gBusy = false
          end beginSprite

          on mouseUp me
          if not(gBusy) then
          gBusy = true --it will not enter here again if gBusy is true.
          startMyCustomFunction()
          end if
          end mouseUp

          ------------------------------------------------

          when the program finishes the execution, you MUST set gBusy = false so the program can attend another mouseUp call.

          for example:

          on endMyFunction
          gBusy = flase
          end endMyFunction