|
|
|
Drag Sprite with Hotspot
Added on 9/23/2004
|
|
Compatibilities:
|
This item has not yet been rated
|
This adds the ability to drag a sprite with a FIXED hotspot defined. It is primairily intended for dragging windows from the top (folder windows, Explorer Windows etc...). It can be changed by altering "mouseH, mouseV" and sprite.top, sprite.right etc... You cannot define an irregular (non rectangular) hotspot with this behavior. Dont' know if this works in any version other than the MX(s).
property spriteNum, pMySpriteRef, topSpot
on getBehaviorDescription me
return
"how much from top?" & RETURN & RETURN &
"PERMITTED MEMBER TYPES:" & RETURN &
"Graphic" & RETURN & RETURN &
"PARAMETERS:" & RETURN &
"* pixels from top?"
end getBehaviorDescription
on getBehaviorTooltip me
return
"Drag a sprite with a hotspot defined. "
end getBehaviorTooltip
on isOKToAttach (me, aSpriteType, aSpriteNum)
tIsOk = 0
if aSpriteType = #graphic then
tIsOK = 1
end if
return(tIsOK)
end on
on getPropertyDescriptionList me
return
[
#topSpot:
[
#comment: "How many pixels from top of sprite?",
#format: #integer,
#default: 33
]
]
end getPropertyDescriptionList
on beginSprite me
pMySpriteRef = sprite(me.spriteNum)
sprite(pMySpriteRef).moveableSprite = FALSE
end
on mouseDown me
if ((the mouseH > pMySpriteRef.left) and (the mouseH < pMySpriteRef.right)) and ((the mouseV > pMySpriteRef.top) and (the mouseV < pMySpriteRef.top+topSpot)) then
sprite(pMySpriteRef).moveableSprite = TRUE
else
sprite(pMySpriteRef).moveableSprite = FALSE
end if
end
on getBehaviorTooltip me
return
"Drag a sprite with a hotspot defined. "
end getBehaviorTooltip
on isOKToAttach (me, aSpriteType, aSpriteNum)
tIsOk = 0
if aSpriteType = #graphic then
tIsOK = 1
end if
return(tIsOK)
end on
on getPropertyDescriptionList me
return
[
#topSpot:
[
#comment: "How many pixels from top of sprite?",
#format: #integer,
#default: 33
]
]
end getPropertyDescriptionList
on beginSprite me
pMySpriteRef = sprite(me.spriteNum)
sprite(pMySpriteRef).moveableSprite = FALSE
end
on mouseDown me
if ((the mouseH > pMySpriteRef.left) and (the mouseH < pMySpriteRef.right)) and ((the mouseV > pMySpriteRef.top) and (the mouseV < pMySpriteRef.top+topSpot)) then
sprite(pMySpriteRef).moveableSprite = TRUE
else
sprite(pMySpriteRef).moveableSprite = FALSE
end if
end
|
|