A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: pan website with mouse?

  1. #1
    Junior Member
    Join Date
    Apr 2009
    Posts
    16

    pan website with mouse?

    hey everyone,

    I am wondering how hard it would be to write some script that paned my website horizontally either with a scroll bar at the bottom or by clicking the empty space and dragging?

    if anyone knows of some tuts and could show me I would greatly!!!!! appreciate it.

    thanks, micah

  2. #2
    Flash Intermediate XenElement's Avatar
    Join Date
    Sep 2008
    Location
    At my computer
    Posts
    196
    Is this the kind of thing you were looking for? I think you could apply a simple drag and drop to the background. You would have to put limits on how far you could drag though.

    EX:

    Code:
    // Register mouse event functions
    blue_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    blue_btn.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
     
    red_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    red_btn.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
     
    // Define a mouse down handler (user is dragging)
    function mouseDownHandler(evt:MouseEvent):void {
    	var object = evt.target;
    	// we should limit dragging to the size of the page.
    	object.startDrag();
    }
     
    function mouseUpHandler(evt:MouseEvent):void {
    	var obj = evt.target;
    		obj.stopDrag();
    }


    Maybe to limit the dragging:

    Code:
    //add this to the "function mouseDownHandler()", 
    if (background.x < leftXLimit && background.x < rightXLimit && background.y < topYLimit && background.y < bottomXLimit) {
    }


    or something like that. try it out, hope this helps!
    In the process of designing a quirky little game engine called gulp. Check out it's progress below: @ my blog.

    ---

    Check out my blog at XenElement.com

  3. #3
    Junior Member
    Join Date
    Apr 2009
    Posts
    16
    hey xen thank you, I will try that and see what it comes up with

  4. #4
    Flash Intermediate XenElement's Avatar
    Join Date
    Sep 2008
    Location
    At my computer
    Posts
    196
    Oh By the way, here's the URL of that tutorial. I forgot you asked for the "tut".

    http://edutechwiki.unige.ch/en/Flash..._drop_tutorial
    In the process of designing a quirky little game engine called gulp. Check out it's progress below: @ my blog.

    ---

    Check out my blog at XenElement.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center