home *** CD-ROM | disk | FTP | other *** search
/ MacFormat UK 163 - Disc 1 / MF_UK_163_1.iso / pc / Files / Scenes / disclaimer.dir / 00031_Clickable Links (Alongi).ls < prev    next >
Encoding:
Text File  |  2005-08-24  |  1.7 KB  |  71 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 mouseUpOutSide me
  10.   scrollmode = "off"
  11. end
  12.  
  13. on mouseUp me
  14.   scrollmode = "off"
  15.   wordText = currentMember.word[wordNum]
  16.   if wordText contains "@" then
  17.     gotoNetPage("mailto:" & wordText)
  18.   else
  19.     nothing()
  20.   end if
  21.   if wordText.char[1..7] = "http://" then
  22.     gotoNetPage(wordText)
  23.   else
  24.     nothing()
  25.   end if
  26.   if wordText.char[1..8] = "https://" then
  27.     gotoNetPage(wordText)
  28.   else
  29.     nothing()
  30.   end if
  31.   if wordText.char[1..4] = "www." then
  32.     gotoNetPage("http://" & wordText)
  33.   else
  34.     nothing()
  35.   end if
  36. end
  37.  
  38. on linkUpdate me
  39.   t = sprite(me.spriteNum).member
  40.   repeat with i = 1 to t.word.count
  41.     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
  42.       t.word[i].color = rgb(204, 204, 204)
  43.     end if
  44.   end repeat
  45. end
  46.  
  47. on exitFrame me
  48.   if scrollmode = "scroll" then
  49.     sprite(me.spriteNum).member.scrollTop = sprite(me.spriteNum).member.scrollTop + ((the mouseV - cStart) / 10)
  50.   end if
  51. end
  52.  
  53. on mouseWithin me
  54.   cursor(260)
  55.   pointClicked = the mouseLoc
  56.   currentMember = sprite(me.spriteNum).member
  57.   wordNum = sprite(me.spriteNum).pointToWord(pointClicked)
  58.   if wordNum <> -1 then
  59.     wordText2 = currentMember.word[wordNum]
  60.     if (wordText2.char[1..7] = "http://") or (wordText2 contains "@") or (wordText2.char[1..4] = "www.") or (wordText2.char[1..8] = "https://") then
  61.       cursor(280)
  62.     else
  63.       cursor(260)
  64.     end if
  65.   end if
  66. end
  67.  
  68. on mouseLeave
  69.   cursor(-1)
  70. end
  71.