1 Reply Latest reply on Apr 17, 2008 7:15 AM by Newsgroup_User

    Inert Button

    cupRamen
      Hiya i need a piece of lingo code that can make a button inert, in other words once i have pressed on it and its taken me to that page, i cannot press it again. So it becomes inactive until i press another button which takes me to another page. thanks in advance
        • 1. Re: Inert Button
          Level 7
          You would set a property to act as a switch. The switch starts off
          active, then when the button is pushed, it sets itself to inactive.
          Then, when or if you want it to become active, you send the sprite a
          message to activate it. In my example below, if the button was in
          sprite channel 1, then you could use the following commands:

          sendAllSprites(#makeActive,1) --activates sprite 1
          sendAllSprites(#makeInactive,1) --deactivates sprite 1

          Put whichever command is appropriate to activate or deactivate the
          button if you need to. If you leave the page that the sprite is on,
          then re-enter it, it will be automatically reactivated (on it's
          beginSprite() event).


          ---START HERE
          property pActive

          on beginSprite me
          me.makeActive(me.spriteNum)
          end

          on makeActive me,vSpriteNum
          if vSpriteNum=me.spriteNum then
          sprite(me.spriteNum).pActive=1
          end if
          end

          on makeInactive me,vSpriteNum
          if vSpriteNum=me.spriteNum then
          sprite(me.spriteNum).pActive=0
          end if
          end

          on mouseUp me
          if pActive then
          --do whatever it is that the button should do
          me.makeInactive(me.spriteNum)
          end if
          end
          --END HERE