property pEvent, pParam, pMarkerToGo
property pChangeCursor, pWhichCursor

-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

on beginsprite me
  pChangeCursor = (pWhichCursor <> 0)
end

-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

on endsprite me
  if pChangeCursor then cursor 0
end

-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

on mouseEnter me
  if pChangeCursor then cursor pWhichCursor
  if pEvent = #mouseEnter then mDoAction me
  pass
end

-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

on mouseLeave me
  if pChangeCursor then cursor 0
  if pEvent = #mouseLeave then mDoAction me
  pass
end

-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

on mouseUp me
  if pEvent = #mouseUp then mDoAction me
end

-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

on mouseDown me
  if pEvent = #mouseDown then mDoAction me
end

-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

on exitFrame me
  if pEvent = #exitFrame then mDoAction me
end

-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

on mDoAction me
  if pChangeCursor then cursor 0
  
  if pMarkerToGo = "Go To Frame X" then
    if char 1 of pParam = "+" then
      go the frame + integer(pParam.char[2 .. pParam.char.count])
    else if char 1 of pParam = "-" then
      go the frame - integer(pParam.char[2 .. pParam.char.count])
    else
      go integer(pParam)
    end if
  else
    if the markerlist.getPos(pMarkerToGo) > 0 then go to pMarkerToGo
    else put "Label" && pMarkerToGo && "not found!"
  end if
  
end

-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

on getPropertyDescriptionList
  retliste = [:]
  
  mli = ["Go To Frame X"]
  repeat with thisM in the markerlist
    mli.add(thisM)
  end repeat
  
  retliste[#pEvent] = [#format:#symbol, #default:#mouseUp, #range:[#mouseUp, #mouseDown, #mouseEnter, #mouseLeave, #exitFrame], comment:"Trigger:"]
  retliste[#pMarkerToGo] = [#default: "", #format:#string, #range: mli, #comment:"Label name or frame number ?"]
  retliste[#pParam] = [#format:#string, #default:"+0", comment:"Frame number (if label name = go to frame x)"]
  retliste[#pWhichCursor] = [#format:#integer, #default:280, comment:"Change cursor on mouseEnter (0 = no cursor change)"]
  
  return retliste
end

