this code is similar that you want
-----------------------------------------------------------------
global gSelectOn, gDragOn, gZoomIn, gZoomOut, gZoomInOut, gRegionName,
gLanguage
global gWidthMin, gWidthMax, gWidthCurrent
global gDimensionMin, gDimensionMax, gDimensionCurrent
global gPositionLeft, gPositionRight
-- PROPERTIES --
property pSprite -- sprite object
property pActive -- activity flag
-- EVENT HANDLERS --
on beginSprite me
-- determine sprite object reference
pSprite = sprite (me.spriteNum)
-- set activity flag
pActive = FALSE
end beginSprite
---
on prepareFrame me
-- if mouse has somehow moved off of sprite and been released
-- turn off activity flag
if the mouseUp then mDrag FALSE
-- if active, move sprite to follow cursor
if pActive then
mDragSprite me
end if
end prepareFrame
---
on mouseUp me
-- turn off activity flag when mouse is released
mDrag FALSE
end mouseUp
---
on mouseDown me
repeat while the mouseDown
if gZoomInOut = 1 then
ZoomFlashMap
ZoomDragHorizontalVerticalBar
updateStage
end if
if gDragOn = 1 then
mDrag TRUE
ZoomDragHorizontalVerticalBar
updateStage
end if
if gSelectOn = 1 then
case sprite(1).mouseOverButton of
TRUE:
cursor 290
FALSE:
cursor -1
end case
end if
end repeat
end
---
on rightMouseDown me
if gDragOn = 0 then
if gZoomIn = 1 then
set gZoomOut = 1
set gZoomIn = 0
cursor 303
repeat while the rightMouseDown
ZoomFlashMap
ZoomDragHorizontalVerticalBar
updateStage
end repeat
else
set gZoomOut = 0
set gZoomIn = 1
cursor 302
repeat while the rightMouseDown
ZoomFlashMap
ZoomDragHorizontalVerticalBar
updateStage
end repeat
end if
end if
end
---
on rightMouseUp me
if gDragOn = 0 then
if gZoomIn = 1 then
set gZoomOut = 1
set gZoomIn = 0
cursor 303
updateStage
else
set gZoomOut = 0
set gZoomIn = 1
cursor 302
updateStage
end if
end if
end
---
on mouseLeave me
cursor -1
updateStage
end
---
-- CUSTOM HANDLERS --
on mDrag vActive
-- set activity flag
pActive = vActive
-- find distance from sprite loc to mouse click
-- pLocOffset = pSprite.loc - the mouseLoc
-- inform other behaviors of current state
sendAllSprites (#Active_Sprite, the currentSpriteNum * pActive)
end mDrag
---
on mDragSprite
-- move sprite to cursor location offset by difference between
-- original click and sprite loc
-- pSprite.loc = the mouseLoc + pLocOffset
pSprite.locH = (pSprite.locH - ((the mouseH - the locH of the clickLoc) *
0.05))
pSprite.locV = (pSprite.locV - ((the mouseV - the locV of the clickLoc) *
0.05))
vLeftDiff = pSprite.rect.left
if vLeftDiff > 0 then
pSprite.locH = pSprite.locH - vLeftDiff
end if
vRightDiff = pSprite.rect.right - the stage.rect.width
if vRightDiff < 0 then
pSprite.locH = pSprite.locH - vRightDiff
end if
vTopDiff = pSprite.rect.top
if vTopDiff > 0 then
pSprite.locV = pSprite.locV - vTopDiff
end if
vBottomDiff = pSprite.rect.bottom - the stage.rect.height
if vBottomDiff < 0 then
pSprite.locV = pSprite.locV - vBottomDiff
end if
end mDragSprite
-- INTER-BEHAVIOR COMMUNICATION
on Forwarded_mouseDown me
-- turn on activity flag when mouse click is initially
-- intercepted by another behavior and forwarded
if not pActive then
mDrag TRUE
end if
return the currentSpriteNum
end Forwarded_mouseDown
---
on ZoomFlashMap
if rollover (1) then
if gZoomOut = 1 then
if gWidthCurrent <= gWidthMin then
sprite(1).width = gWidthMin
sprite(1).height = sprite(1).width * 0.7500
PositionFlashMap
updateStage
else
gDimensionCurrent = gDimensionCurrent + 20.0000
sprite(2).width = gDimensionCurrent
sprite(3).height = sprite(2).width * 0.7500
gWidthCurrent = gWidthCurrent - 40.0000
gPositionLeft = gPositionLeft + 20
gPositionRight = gPositionRight - 20
sprite(1).width = gWidthCurrent
sprite(1).height = sprite(1).width * 0.7500
PositionFlashMap
updateStage
end if
else
if gWidthCurrent >= gWidthMax then
sprite(1).width = gWidthMax
sprite(1).height = sprite(1).width * 0.7500
PositionFlashMap
updateStage
else
gDimensionCurrent = gDimensionCurrent - 20.0000
sprite(2).width = gDimensionCurrent
sprite(3).height = sprite(2).width * 0.7500
gWidthCurrent = gWidthCurrent + 40.0000
gPositionLeft = gPositionLeft - 20
gPositionRight = gPositionRight + 20
sprite(1).width = gWidthCurrent
sprite(1).height = sprite(1).width * 0.7500
PositionFlashMap
updateStage
end if
end if
end if
end ZoomFlashMap
---
on PositionFlashMap
vLeftDiff = sprite(1).rect.left
if vLeftDiff >= 0 then
-- sprite(1).locH = sprite(1).locH - vLeftDiff
set the locH of sprite 1 to constrainH(1, (sprite(1).rect.width /2))
end if
vRightDiff = sprite(1).rect.right - the stage.rect.width
if vRightDiff <= 0 then
sprite(1).locH = sprite(1).locH - vRightDiff
end if
vTopDiff = sprite(1).rect.top
if vTopDiff >= 0 then
-- sprite(1).locV = sprite(1).locV - vTopDiff
set the locV of sprite 1 to constrainH(1, (sprite(1).rect.height /2))
end if
vBottomDiff = sprite(1).rect.bottom - the stage.rect.height
if vBottomDiff <= 0 then
sprite(1).locV = sprite(1).locV - vBottomDiff
end if
end PositionFlashMap
---
on ZoomDragHorizontalVerticalBar
cH = (gPositionRight - gPositionLeft) / (800.0001 - sprite(2).width)
cV = ((gPositionRight * 0.7500) - (gPositionLeft * 0.7500)) / (600.0001 -
sprite(3).height)
sprite(2).locH = ((800 - sprite(2).width) / 2) + (sprite(2).width -
((sprite(1).locH - 400) / cH))
sprite(3).locV = ((600 - sprite(3).height) / 2) + (sprite(3).height -
((sprite(1).locV - 300) / cV))
end ZoomDragHorizontalVerticalBar
---
-----------------------------------
on getURL me, stringFromFlash
set gRegionName = stringFromFlash
puppetTransition 51, 2, 20, FALSE
go to frame 246
end
----- Original Message -----
From: "Martha Arifin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 07, 2001 3:35 PM
Subject: <lingo-l> Re: checking boundaries for panning image
> Hi all,
> I am trying to build a lingo-based panorama. I have some code happening
for
> panning left/right & zooming in/out relative to mouse movement. It works
> fine, except when it's on its max left edge (or max right if i pan to the
> left) and you move your to the half bottom of the image (which should zoom
> the image out) it's still zooming out regardless that I have put the code
> for checking the left and right boundaries... therefore the image is going
> smaller than the constrained area.
>
> Here's the link with the dummy image:
>
> http://interchange.virtualave.net/panoramatest/panorama05.html
> (oopss... and forgive the popups)
>
> i have been pulling my hair trying to get around the scripting, but i
still
> couldnt get it right. Anyone can help? I can send the current script if
that
> might help...
>
> Martha
> [EMAIL PROTECTED]
>
>
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.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!]
>
[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!]