At 5:04 PM +1000 8/21/02, you wrote:
>I want to be able to change the characters in a given textfeild randomly?
>Like a scrabbled word?

drop this behavior on a field
click on it
cmd-click/ctrl-click on it to reset it


hth
-Buzz
---------------------------------------------
property spr, memb, orig

on beginSprite me
   spr = sprite(me.spriteNum)
   memb = spr.member
   orig = memb.text
end

on mouseUp me
   if (the commandDown) then resetText
   else scrambleText
end

on scrambleText me
   list1 = []
   n = memb.char.count
   repeat with i = 1 to n
     list1[i] = i
   end repeat
   list2 = []
   repeat with i = 1 to n
     k = list1.count
     pick = random(k)
     list2.append(list1[pick])
     list1.deleteAt(pick)
   end repeat
   --  put list2
   newStr = ""
   repeat with i = 1 to n
     newStr = newStr & memb.char[list2[i]]
   end repeat
   --  put newStr
   memb.text = newStr
end

on resetText me
   memb.text = orig
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