property pSprite,pOrgName,pRoName,pDoName,pHelpText,pCursor,pCastLib,pActive

on new me
  
  return me
end new


on mInitSprite me,helpText
  set pHelpText = helpText
  set pCursor = [the number of member "cur1" of castLib "comm",the number of member "cur2" of castLib "comm"]
  
  mSetActive(me)
  
  puppetSprite pSprite,true
  
  if the name of member (the memberNum of sprite pSprite) <> "" then
    set pCastLib = the castLibNum of sprite pSprite
    set myOrgName = the name of member (the memberNum of sprite pSprite)
    set pOrgName = the number of member myOrgName of castLib pCastLib
    set pRoName  = the number of member ("!" & chars(myOrgName,2,length(myOrgName))) of castLib pCastLib
    set pDoName  = the number of member ("" & chars(myOrgName,2,length(myOrgName))) of castLib pCastLib
  else
    set pOrgName = ""
  end if
end mInitSprite


on mSetPause me
  set the cursor of sprite pSprite to -1
  set pActive = FALSE
end mSetPause


on mSetActive me
  set the cursor of sprite pSprite to pCursor
  set pActive = TRUE
end mSetActive


on mKillPuppet me
  puppetSprite pSprite,false
end mKillPuppet


on mouseUp me
  if pActive then
    set the memberNum of sprite pSprite to pRoName    
  end if
end mouseUp


on mouseDown me
  if pActive then
    set the memberNum of sprite pSprite to pDoName
  end if
end mouseDown


on mouseEnter me
  Global gHelpObj
  
  if pActive then
    set the memberNum of sprite pSprite to pRoName
    mOpenHelp(gHelpObj,pHelpText,pSprite,pCursor)
  end if
end mouseEnter


on mouseLeave me
  Global gHelpObj
  
  set the memberNum of sprite pSprite to pOrgName
  
  if pActive then
    mCloseHelp(gHelpObj)
  end if
end mouseLeave


on mouseWithin me
  Global gHelpObj
  
  if pActive then
    mShowHelp(gHelpObj)
  end if
end mouseWithin


on mouseUpOutside me
  if pActive then
    set the memberNum of sprite pSprite to pOrgName
  end if
end mouseUpOutside

