2 Replies Latest reply on Jul 27, 2006 3:36 AM by grahamdeuchar

    Pan/scroll restriction

    grahamdeuchar
      Hey guys,

      I was never the world's greatest mathematician, so there is probably a really basic calculation you can perform to achieve this, but would anyone happen to be able to help with this:

      I have a Flash map I've been developing, in which users can scroll left/right/up/down/down-left etc around the map. The map itself is in a movieclip, so for zooming I will be simply increasing/decreasing the scale of the movieclip.

      My problem lies in trying to restrict how far the user can scroll with my buttons - at the moment they can scroll the map movieclip right off the screen till it's no longer visible - how do I limit how far they can scroll based on the map/viewing area position AND cater for the zoom - obviously these positions will change as the scale of the map does!

      Any help would be greatly appreciated guys!

      Cheers,
      Graham
        • 1. Re: Pan/scroll restriction
          Level 7
          back = map
          front = screen/mask

          on button click handler, do:

          if(back._x+back._width > front._x+front._width)
          {
          back._x --
          }

          provided the registration point for both front and back are at the top left

          hope this helps.

          "grahamdeuchar" <webforumsuser@macromedia.com> wrote in message
          news:ea7e6a$q4d$1@forums.macromedia.com...
          > Hey guys,
          >
          > I was never the world's greatest mathematician, so there is probably a
          > really
          > basic calculation you can perform to achieve this, but would anyone happen
          > to
          > be able to help with this:
          >
          > I have a Flash map I've been developing, in which users can scroll
          > left/right/up/down/down-left etc around the map. The map itself is in a
          > movieclip, so for zooming I will be simply increasing/decreasing the scale
          > of
          > the movieclip.
          >
          > My problem lies in trying to restrict how far the user can scroll with my
          > buttons - at the moment they can scroll the map movieclip right off the
          > screen
          > till it's no longer visible - how do I limit how far they can scroll based
          > on
          > the map/viewing area position AND cater for the zoom - obviously these
          > positions will change as the scale of the map does!
          >
          > Any help would be greatly appreciated guys!
          >
          > Cheers,
          > Graham
          >


          • 2. Re: Pan/scroll restriction
            grahamdeuchar Level 1
            Thanks for your reply!
            I'm probably being really stupid but I still can't get it working :(
            I've attached my code as an example - that's the left button's action. Can anyone see any problems?