--You need one text or field member for all tips for buttons.
--Just put one text member somewhere in the score and off the stage, and apply this behaviour to button sprite. Hoffset and Voffset are for the fine position tuning.
--Tooltip behavior by Dejan Cicic
--copyright DEXSOFT Multimedia - 1999
--Use one sprite and one text or field member for all tips for buttons.
--Just put one text member off the stage and apply this behaviour
--to button sprite.
Property SpriteNum
Property TipSpriteNum
Property TipText
property Hoffset
property Voffset
property mySprite
property myTop
property myLeft
property myRight
property myBottom
on beginSprite me
set mySprite=the spriteNum of me
set myTop= the Top of sprite mySprite
put mytop
set myBottom= the bottom of sprite mySprite
put mybottom
set myLeft= the left of sprite mySprite
put myleft
set myRight= the right of sprite mySprite
put myright
--off the stage tip sprite
set the loch of sprite TipSpriteNum to -1000
end beginSprite
on MouseEnter me
set the text of member (the membernum of sprite tipSpriteNum) to TipText
end MouseEnter
on MouseLeave me
--if not within sprite the put off the stage
set the loch of sprite tipSpriteNum to -1000
end MouseLeave
on MouseWithin me
-- if close to left side of the stage then position of tip is equal with the left of sprite
set stageWidth = the stageRight - the stageLeft
if myright>(Stagewidth-20) then
set tipHpos=myLeft-100
else
set tipHPos=(myRight+ myLeft)/2 -20
end if
if MyTop<(the stageTop+20) then
set tipVpos=mybottom+10
else
set tipVpos=MyTop -20
end if
set the locH of sprite tipSpriteNum to tipHpos+Hoffset
set the locV of sprite tipSpriteNum to tipVpos+Voffset
end
end MouseWithin
on getPropertyDescriptionList
Properties = [:]
AddProp Properties,#TipSpriteNum,[#Default:1,#Format:#Integer,#Comment:"Sprite num for tip",#Range:[#Min:0,#Max:200]]
AddProp Properties,#TipText,[#Default:"Toll tip text",#Format:#String,#Comment:"Text for a tip"]
AddProp Properties,#Hoffset,[#Default:0,#Format:#Integer,#Comment:"Horizontal offset for fine position tuning",#Range:[#Min:-255,#Max:255]]
AddProp Properties,#Voffset,[#Default:0,#Format:#Integer,#Comment:"Vertical offset for fine position tuning",#Range:[#Min:-255,#Max:255]]
Return Properties
end getPropertyDescriptionList
on getBehaviorDescription
BehDescription = "You need one text or field member for all tips for buttons. Just put one text member somewhere in the score and off the stage and apply this behaviour to button sprite. Hoffset and Voffset are for the fine position tuning."
Return BehDescription
end getBehaviorDescription
on getBehaviorTooltip
ToolTip = "Aplly this behavior for tooltip"
Return ToolTip
end getBehaviorTooltip
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA