|
|
|
Constrain Mouse to Stage Area
Added on 6/15/2000
|
This behavior uses the Free Set Mouse Xtra to confine the mouse to the stage area.
global mouseposLR, mouseposTB, Con1, Con2, Con3, Con4
on exitframe
--sets the variables wich are mouse location = the size of the stage
set mouseposlr = the mouseH + the stageleft
set mouseposTB = the mouseV + the stagetop
--tests wether or not the mouse is leaving the stage
if mouseposLR > the stageRight - 2 then set Con1 = true
else set Con1 = false
if mouseposTB < the stageTop + 2 then set Con2 = true
else set Con2 = false
if mouseposLR < the StageLeft + 2 then set Con3 = true
else set Con3 = false
if mouseposTB > the stageBottom - 2 then set Con4 = true
else set Con4 = false
--sets the mouse to snapback to the givin parameters
case True of
Con1:
x = the stageRight - 2
y = the mouseV + the stagetop
setmouse x,y
Con2:
x = the mouseH + the stageleft
y = the stageTop + 2
setmouse x,y
Con3:
x = the stageLeft + 2
y = the mouseV + the stageTop
setmouse x,y
Con4:
x = the mouseH + the stageLeft
y = the stageBottom - 2
setmouse x,y
end case
go to the frame
end
on getBehaviorDescription me
return "This behavior uses the Free Set Mouse Xtra to confine the mouse to the stage area."
end
|
|