X and Y positions inaccurate after startDrag with boundaries set.

Working with a recent project, I had to create a pseudo swipe on a nav bar button (CS5 was not available). So I put a listener on the button which would detect the MOUSE_DOWN and MOUSE_UP positions, and compare the difference of the mouse x/y positions to see if there was a swipe. Because the button was within a nav bar that had to be scrolled, the button had a startDrag() attached to it so it could move up and down while detecting if there was a left/right swipe.

However, once I added that startDrag() method, the x and y co-ordinates started giving me inaccurate results. If you try the following code, you will see that the x/y positions traced are exactly the same at the start and end of the click, even if myBox has been dragged 100 pixels.

import flash.events.MouseEvent;

var myBox:Sprite = this.getChildByName("myBox") as Sprite;
myBox.addEventListener(MouseEvent.MOUSE_DOWN, boxDownHandler, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, boxUpHandler, false, 0, true);

function boxDownHandler($evt:MouseEvent):void{
	myBox.startDrag(false, new Rectangle(0,100,0,100));
	trace("STARTING MOUSE POS:", stage.mouseX, myBox.mouseY);
}

function boxUpHandler($evt:MouseEvent):void{
	myBox.stopDrag();

	trace("ENDING MOUSE POS:", stage.mouseX, myBox.mouseY)
}

I never figured out why it wasn't allowing me to get the x/y positions of the mouse, considering it was independent of the clip being dragged. However, I found a workaround. If you simply get the mouseX and mouseY position while the box is being moved, and ignore the result at the end, it gives you accurate results that you can use.

import flash.events.MouseEvent;

var myBox:Sprite = this.getChildByName("myBox") as Sprite;
myBox.addEventListener(MouseEvent.MOUSE_DOWN, boxDownHandler, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, boxUpHandler, false, 0, true);

function boxDownHandler($evt:MouseEvent):void{
	myBox.startDrag(false, new Rectangle(0,100,0,100));
	trace("STARTING MOUSE POS:", stage.mouseX, myBox.mouseY);
	myBox.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler, false, 0, true);
}

function boxUpHandler($evt:MouseEvent):void{
	myBox.stopDrag();
	myBox.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
	trace("ENDING MOUSE POS:", stage.mouseX, myBox.mouseY)
}

function mouseMoveHandler($evt:MouseEvent):void{
	trace("MOVING MOUSE POS:", stage.mouseX, myBox.mouseY)
}

TweenMax does loading

Haven't tried it out yet, but it will be in my next project. Greensock is now taking on loading with
LoaderMax. Number of features seems to overtake my usual BulkLoader, and he usually dishes out good stuff. So I'm looking forward to giving it a go.