You should maintain a list of clicked words, and use setPref and getPref to
save the list out and read it back in. If you're using text sprites, use
pointToWord() to get the number of the word clicked on (based on the
clickLoc). Don't use the mouseWord, because it gives you the number of the
word under the cursor at the time it is queried, and that may not relate
directly to the click location. Here's a behavior that will do the whole
thing (it's tested). When the sprite begins anew, the state will be read out
of the pref file, and the word colors re-established. Attach it to the text
sprite....

property mlClickedWords
property miSpriteNum
property mmTextMember

on beginSprite me
  mlClickedWords = []
  mlClickedWords.sort()
  miSpriteNum = me.spriteNum
  sprite(miSpriteNum).cursor = 280
  mmTextMember = sprite(miSpriteNum).member
  mmTextMember.foreColor = 255
  me.restoreState()
end

on mouseUp me
  liClickedWord = pointToWord(sprite miSpriteNum, the clickLoc)
  if liClickedWord > 0 then
    if mlClickedWords.getOne(liClickedWord) = 0 then
      mmTextMember.word[liClickedWord].foreColor = 45
      mlClickedWords.add(liClickedWord)
      me.saveState()
    end if
  end if
end

on saveState me
  setPref "wordsv.txt", string(mlClickedWords)
end

on restoreState me
  lsSavedWords = getPref("wordsv.txt")
  if lsSavedWords.length > 0 then
    mlClickedWords = value(lsSavedWords)
    repeat with liWordNum in mlClickedWords
      mmTextMember.word[liWordNum].foreColor = 45
    end repeat
  end if
end

Christopher Watson
Sr. Software Engineer
Lightspan, Inc.


-----Original Message-----
From: Steven Frazier [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 26, 2001 8:06 AM
To: [EMAIL PROTECTED]
Subject: <lingo-l> click on word to change color and save?


Hi
    I would like to click on a word in a text field and change it's color - 
say to red-  and then when the projector
closes save that change to the hard disk so it will be there again when the 
user reboots.
Is this possible?

thanks
Steven

[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/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