home *** CD-ROM | disk | FTP | other *** search
/ MacFormat UK 163 - Disc 1 / MF_UK_163_1.iso / pc / Files / Scenes / toolkit.dir / Internal_66_Clickable Links (Alongi).ls < prev    next >
Encoding:
Text File  |  2005-08-05  |  1.6 KB  |  67 lines

  1. property scrollmode, Sp, cStart
  2. global currentMember, pointClicked, wordNum, wordText2, wordText
  3.  
  4. on mouseDown me
  5.   scrollmode = "scroll"
  6.   cStart = sprite(me.spriteNum).top + (sprite(me.spriteNum).height / 2)
  7. end
  8.  
  9. on mouseUp me
  10.   scrollmode = "off"
  11.   wordText = currentMember.word[wordNum]
  12.   if wordText contains "@" then
  13.     gotoNetPage("mailto:" & wordText)
  14.   else
  15.     nothing()
  16.   end if
  17.   if wordText.char[1..7] = "http://" then
  18.     gotoNetPage(wordText)
  19.   else
  20.     nothing()
  21.   end if
  22.   if wordText.char[1..8] = "https://" then
  23.     gotoNetPage(wordText)
  24.   else
  25.     nothing()
  26.   end if
  27.   if wordText.char[1..4] = "www." then
  28.     gotoNetPage("http://" & wordText)
  29.   else
  30.     nothing()
  31.   end if
  32. end
  33.  
  34. on linkUpdate me
  35.   t = sprite(me.spriteNum).member
  36.   repeat with i = 1 to t.word.count
  37.     if (t.word[i].char[1..7] = "http://") or (t.word[i] contains "@") or (t.word[i].char[1..4] = "www.") or (t.word[i].char[1..8] = "https://") then
  38.       t.word[i].color = rgb(255, 102, 50)
  39.     end if
  40.   end repeat
  41. end
  42.  
  43. on exitFrame me
  44.   if scrollmode = "scroll" then
  45.     sprite(me.spriteNum).member.scrollTop = sprite(me.spriteNum).member.scrollTop + ((the mouseV - cStart) / 10)
  46.   end if
  47. end
  48.  
  49. on mouseWithin me
  50.   cursor(260)
  51.   pointClicked = the mouseLoc
  52.   currentMember = sprite(me.spriteNum).member
  53.   wordNum = sprite(me.spriteNum).pointToWord(pointClicked)
  54.   if wordNum <> -1 then
  55.     wordText2 = currentMember.word[wordNum]
  56.     if (wordText2.char[1..7] = "http://") or (wordText2 contains "@") or (wordText2.char[1..4] = "www.") or (wordText2.char[1..8] = "https://") then
  57.       cursor(280)
  58.     else
  59.       cursor(260)
  60.     end if
  61.   end if
  62. end
  63.  
  64. on mouseLeave
  65.   cursor(-1)
  66. end
  67.