Another problem ... I want to write a handler which counts the number of
words a user types into an editable text sprite. The idea is that the
handler:

1. counts the number of words which are entered, as they are typed;
2.  disallows anything more than 6 words;
3. issues a pop-up message explaining that more than 6 words is not
permitted;
4. responds to the enter key by bringing up the next editable sprite on the
stage.

John Lodge

John,

Put this on a text sprite. Should get you started.

-A.

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

on beginSprite me
  sprite(me.spriteNum).member.editable = TRUE
end


on keyUp me
  myText = sprite(me.spriteNum).member.text

  if mytext.word.count < 7 then
    pass
  else

    case charToNum(the key) of
      8: pass -- backspace

      3: go the frame + 1 -- enter
      13: go the frame + 1 -- carriage return

      otherwise
        alert "no more than 6 words please"

    end case

    delete word 7 of myText
    sprite(me.spriteNum).member.text = myText

  end if
end





[To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi  To post messages to the list, email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to