Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Open Help File
Blend Mode Algorithms - Imaging Lingo
Director-3D.com
==> FlashFere2.2 Available now !!
Swap Language Cast Libraries
Semi-Random Bezier Animatior
Simple Distance Blend
Fast Blur Algorithm
Find windows directory or Macintosh System folder
Elliptical Sprite Behavior
 

 

 

Behavior Constrain Mouse to Stage Area

Added on 6/15/2000

 

Compatibilities:
behavior D7 D8 Mac PC

This item has not yet been rated

Author: TomWincek

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

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail