1 Reply Latest reply on Sep 6, 2008 6:14 AM by Newsgroup_User

    Delete one phrase at a time and retain the rest

    wgb14 Level 1
      Hi all

      I wonder how can I do this in Lingo

      I have an XML file that contains 4 phrases. I load these phrases into DIrector and I would like to allow my users to delete pne phrase at a time and retain the rest. For example

      Phrase1
      Phrase2
      Phrase3
      Phrase4

      If user selects one 2,3,4 should remain in the display field. If 2, 1,3,4 should remain in the display field and so on. The process should continue untill there is only one phrase in the window (any of the 4) where the user should get a message window (game terminated).

      Do you have any idea how to do that?
        • 1. Re: Delete one phrase at a time and retain the rest
          Level 7
          This behavior deletes a line when the user clicks it and displays the
          message when there is one line left. You can easily change it to display
          the message when there is 2 lines left, 3 or whatever. It also saves the
          original complete list and restores it to the member on end sprite.

          You will of course have to fix the unintended line breaks induced by
          your browser/newsreader.



          property spriteNum, pPhrasesLeftForCompletetion, pPhrases

          on beginSprite me
          pPhrases = sprite(spriteNum).member.text
          end

          on endSprite me
          sprite(spriteNum).member.text = pPhrases
          end

          on mouseDown me
          if sprite(spriteNum).member.line.count > pPhrasesLeftForCompletetion then
          lineNumClicked = sprite(spriteNum).pointToLine(the mouseLoc)
          sprite(spriteNum).member.line[lineNumClicked].delete()
          numChars = sprite(spriteNum).member.char.count
          if sprite(spriteNum).member.char[numChars..numChars] = RETURN then
          sprite(spriteNum).member.char[numChars].delete()

          if sprite(spriteNum).member.line.count =
          pPhrasesLeftForCompletetion then
          updateStage
          alert("Game terminated")
          end if
          end if
          end


          on getPropertyDescriptionList
          description = [:]
          addProp description,#pPhrasesLeftForCompletetion, [#default:1,
          #format:#integer, #comment:"How many phrases left indicate complete"]
          return description
          end