Code I

property psymState

on beginSprite me
  psymState = #notOver
end

on mouseEnter me
  psymState = #overAndWaiting
  *  Start a timer  *
end mouseEnter

on mouseLeave me
 * Hide the tooltip *
  psymState = #notOver
end mouseLeave

on mouseUp me
 * Hide the tooltip *
  psymState = #notOver
end

on exitFrame me
  case psymState of
    #notOver:
      nothing

    #overAndWaiting:
    * if we've been in this state for more than 1 second then *
	* show the tooltip *
        psymState = #showing
      end if

    #showing:
      nothing
  end case
end

Code II

property spriteNum  -- the channel in which thhe sprite is located
property pName  -- the text to display
property pmsShowTime  -- the milliseconds at which to show the tooltip
property psymState -- #notOver, #overAndWaiting, #showing
property pRect  -- the rectangle of the rollover area
property pchToolTipDisplay  -- channel number of the ToolTip Display sprite

on beginSprite me
  pName = sprite(spriteNum).member.name
  psymState = #notOver
  pRect = sprite(spriteNum).rect
end beginSprite

on mouseEnter me
  psymState = #overAndWaiting
  pmsShowTime = the milliseconds + 1000
end mouseEnter

on mouseLeave me
  sendSprite(pchToolTipDisplay, #mToolTipDisplay_Hide)
  psymState = #notOver
end mouseLeave

on mouseUp me
  sendSprite(pchToolTipDisplay, #mToolTipDisplay_Hide)
  psymState = #notOver
end

on exitFrame me   case psymState of
    #notOver:
      nothing

    #overAndWaiting:
      -- See if it's time to show the tooltip
      if the milliseconds > pmsShowTime then
        me.mShowToolTip()
        psymState = #showing
      end if

    #showing:
      nothing
  end case
end

on mShowToolTip me
  -- The first time, the channel of the tooltip display is not known yet, let's
  find it
  if voidp(pchToolTipDisplay) then     pchToolTipDisplay =
  	sendAllSprites(#mToolTipDisplay_GetChannel)
  end if
  sendSprite(pchToolTipDisplay, #mTooltipDisplay_Show, pName, pRect)
end

on endSprite me
  sendSprite(pchToolTipDisplay, #mToolTipDisplay_Hide)
end

Code III

property spriteNum

on beginSprite me
  me.mTooltipDisplay_Hide()  -- start off hidden
end

on mTooltipDisplay_GetChannel me
  return spriteNum
end

on mTooltipDisplay_Hide me
   sprite(spriteNum).locV = -1000  -- move offstage
end

on mTooltipDisplay_Show me, theString, rectRolledItem
   put theString && rectRolledItem
end

Code IV

property spriteNum
property pmTooltipText
property pMaxWidthTooltip
property pnPixelsAboveOrBelow

on beginSprite me
  pmTooltipText = sprite(spriteNum).member
  pnPixelsBelow = 4  -- spacing between rect and tooltip
  pMaxWidthTooltip = 200  -- maximum width of the tooltip
  me.mTooltipDisplay_Hide()  -- start off hidden
end

Code V

property spriteNum
property pmTooltipText
property pMaxWidthToolTip
property pnPixelsBelow

on beginSprite me
  pmToolTipText = sprite(spriteNum).member
  pnPixelsBelow = 4  -- spacing between rect and tooltip
  pMaxWidthToolTip = 200  -- maximum width of the tooltip
  me.mToolTipDisplay_Hide()  -- start off hidden
end

on mToolTipDisplay_Hide me
  sprite(spriteNum).locV = -1000   -- move offstage
end

on mToolTipDisplay_GetChannel me
  return spriteNum
end

on endSprite me
  pmToolTipText.text = " "
  me.mToolTipDisplay_Hide()
  updateStage
end

on mToolTipDisplay_Show me, theString, rectRoll   -- Set the max width of the
tooltip
  pmToolTipText.rect = rect(0, 0, pMaxWidthToolTip, 0)
  pmToolTipText.text = theString

  if pmToolTipText.lineCount = 1 then
    -- Only one line, must shrink the width to match the text
    nChars = pmToolTipText.text.char.count
    locLastChar = pmToolTipText.CharPosToLoc(nChars + 1)
    textMemberRect = pmToolTipText.rect
    textMemberRect.right = locLastChar.locH
    pmToolTipText.rect = textMemberRect
  end if

  -- Calculate locH and locV   centerH = (rectRoll.left + rectRoll.right) / 2
  locHTip = centerH - (pmToolTipText.width  / 2)
  locVTip = rectRoll.bottom + pnPixelsBelow

  -- Finally, assign the tooltip location
  sprite(spriteNum).loc = point(locHTip, locVTip) end