home *** CD-ROM | disk | FTP | other *** search
/ Club KidSoft Volume 3 #1 / ClubKidsoft.iso / movies / cover.dir / 00012_Script_12 < prev    next >
Text File  |  1995-02-08  |  2KB  |  90 lines

  1. -- KeyDown in FunWord field
  2.  
  3. --on keyDown
  4. --  if the commandDown = TRUE then -- Let command keys through
  5. --    pass
  6. --    
  7. --  else
  8. --    set curKey = charToNum(the key)
  9. --    
  10. --    --put curKey
  11. --    if curKey = 9 then -- tab
  12. --      set the editableText of sprite 2 to TRUE
  13. --      set the editableText of sprite 6 to FALSE
  14. --      hilite field "Fun Word"
  15. --      
  16. --    else if IsOKCancelKey(the key) = "OK" then
  17. --      puppetSprite 2, FALSE
  18. --      puppetSprite 6, FALSE
  19. --      
  20. --      set the visible of sprite 5 to TRUE
  21. --      updateStage
  22. --      DelayFor 6
  23. --      set the visible of sprite 5 to FALSE
  24. --      updateStage
  25. --      RegisterNow
  26. --      
  27. --    else if (curKey < 48) or (curKey > 57 and curKey < 65) and (curKey > 90 and curKey < 97) or (curKey > 122) then
  28. --      -- not a letter or number
  29. --      
  30. --    else 
  31. --      pass
  32. --    end if
  33. --    
  34. --  end if
  35. --end
  36. --
  37. --on keyUp
  38. --  if the editableText of sprite 6 = TRUE then
  39. --    put FormatFunWord(FormalizeFunWord(field "Fun Word")) into field "Fun Word"
  40. --  end if
  41. --end
  42.  
  43. on mouseDown
  44.   set the editableText of sprite 2 to TRUE
  45.   set the editableText of sprite 6 to FALSE
  46. end
  47.  
  48. on keyDown
  49.   if the commandDown = TRUE then -- Let command keys through
  50.     pass
  51.     
  52.   else
  53.     set curKey = charToNum(the key)
  54.     
  55.     if curKey = 9 then -- tab key
  56.       EditRegCode
  57.       
  58.     else if IsOKCancelKey(the key) = "OK" then
  59.       set the visible of sprite 5 to TRUE
  60.       updateStage
  61.       DelayFor 6
  62.       set the visible of sprite 5 to FALSE
  63.       updateStage
  64.       CLICK
  65.       RegisterNow
  66.       
  67.     else if curKey = 8 then -- Allow delete key
  68.       set curStr = field "Fun Word"
  69.       set numChars = the number of chars of curStr
  70.       delete char numChars of curStr
  71.       put curStr into field "Fun Word"
  72.       
  73.     else if (curKey < 48) or (curKey > 57 and curKey < 65) and (curKey > 90 and curKey < 97) or (curKey > 122) then
  74.       -- Ignore the key if not a letter (upper or lower)
  75.       
  76.     else -- must be a number or letter key
  77.       set numChars = the number of chars of field "Fun Word"
  78.       if numChars = 8 then exit
  79.       
  80.       if curKey >= 97 then 
  81.         set curKey = curKey - 32
  82.       end if
  83.       put numToChar(curKey) after field "Fun Word"
  84.     end if
  85.     
  86.     set the selEnd to 100
  87.     set the selStart to 100
  88.   end if
  89. end
  90.