I have a movie clip called site plan (which is an image of a site plan) and I have zoom gestures in place to to zoom in and those are working well. Now I want to put MouseEvents in place to do dragging when the movie clip is is zoomed in. I seem to having trouble with setting the Rectangle area x and y axis. What I am to do is make the movie clip dragged inside the 1080 x 1420 area and have the following when zoomed in
- Bottom of the image is at the bottom of the rectangle area stop dragging
- Top of the image is at the top of the rectangle area stop dragging
- Left side of the image is at the left of the rectangle area stop dragging
- Right side of the image is at the right of the rectangle area stop dragging.
My code is below. The size of my image is 1080 x 1420 and my stage is 1080 * 1920
siteplan.addEventListener(MouseEvent.MOUSE_DOWN, dragStart);
siteplan.addEventListener(MouseEvent.MOUSE_UP, dragEnd);
function dragStart(e:MouseEvent):void
{
var rect:Rectangle = new Rectangle(0 - 1080, 0 - 1920, 1080, 1420);
siteplan.startDrag(false, rect);
}
function dragEnd(e:MouseEvent):void
{
siteplan.stopDrag();
}
I hope this make sense, Please Help!
I have also tried:
function dragStart(e:MouseEvent):void
{
var rect:Rectangle = new Rectangle(0 - (1080 * e.currentTarget.x), 0 - (1920 * e.currentTarget.y), 1080, 1420);
siteplan.startDrag(false, rect);
}