At 12:55 PM -0400 9/7/00, Mark R. Jonkman wrote:
>Hi Colby
>
>This is untested lingo to get you going
>
>property p_Int_MaxHeight
>property p_Int_MinHeight
>property p_Sprite
>property p_Int_InitX
>property p_Int_InitY
>property p_Bool_DragFlag
>
>on beginSprite me
> p_Int_MaxHeight = 100
> p_Int_MinHeight = 0
> p_Sprite = sprite(me.spriteNum)
> p_Sprite.loc = point(p_Int_InitX, p_Int_InitY)
>end beginSprite
>
>on mouseDown me
> p_Bool_DragFlag = TRUE
> mDrag(me)
>end mouseDown
>
>on mouseUp me
> p_Bool_DragFlag = FALSE
>end mouseUp
>
>on prepareFrame me
> if p_Bool_DragFlag then
> mDrag(me)
> end if
>end prepareFrame
>
>on mDrag me
> v_Int_CurrentLocV = (the mouseLoc).locV
> if (v_IntCurrentLocV >= p_Int_MinHeight) or (vIntCurrentLocV <=
>p_Int_MaxHeight) then
> pSprite.locV = v_IntCurrentLocV
> else
> if (vIntCurrentLocV < p_Int_MinHeight) then
> pSprite.locV = p_Int_MinHeight
> else
> pSprite.locV = p_Int_MaxHeight
> end if
> end if
>end mDrag
>
Mark's approach here was right on. I just cleaned it up a bit, added
an important on mouseUpOutside handler, and changed an "or" to an
"and" in his mDrag handler:
property p_Int_MaxHeight
property p_Int_MinHeight
property p_Sprite
property p_Int_InitX
property p_Int_InitY
property p_Bool_DragFlag
on beginSprite me
p_Int_MaxHeight = 100
p_Int_MinHeight = 0
p_Sprite = sprite(me.spriteNum)
end beginSprite
on mouseDown me
p_Bool_DragFlag = TRUE
mDrag(me)
end mouseDown
on mouseUp me
p_Bool_DragFlag = FALSE
end mouseUp
on mouseUpOutside me
p_Bool_DragFlag = FALSE
end mouseUpOutside
on prepareFrame me
if p_Bool_DragFlag then
mDrag(me)
end if
end prepareFrame
on mDrag me
v_Int_CurrentLocV = (the mouseLoc).locV
if (v_Int_CurrentLocV >= p_Int_MinHeight) and (v_Int_CurrentLocV
<=p_Int_MaxHeight) then
p_Sprite.locV = v_Int_CurrentLocV
else
if (v_Int_CurrentLocV < p_Int_MinHeight) then
p_Sprite.locV = p_Int_MinHeight
else
p_Sprite.locV = p_Int_MaxHeight
end if
end if
end mDrag
--
Lingo / Director / Shockwave development for all occasions
(We even do weddings and Bar Mitzvahs!)
See our kid's CD-Rom's at: http://www.furrypants.com
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]