Has anyone else had problems with Sprite#startDrag() when
using the optional parameters?
According to the documentation, I should be able to compile
tile.startDrag( true, tile.parent.getBounds());
This behavior is documented as:
public function startDrag(lockCenter:Boolean = false,
bounds:Rectangle = null):void
where the first parameter says "center the sprite on the
mouse" rather than where the use clicked and the second parameter
constrains the movement of the sprite to the bounding box, measured
in the Sprite's parent's coordinates.
However, when I go to compile this, the first error I get is
that Sprite#startDrag() only accepts one argument:
mover.mxml(17): Error: Incorrect number of arguments.
t.startDrag( false, t.parent.getBounds());
Ooops...which one? It turns out it only takes the less useful
one (lockCenter). However, when I try:
I do not get the described behavior at all. Instead, the
mouse is locked to 0,0 on the Sprite and the mouseUp will not work
at all (the Sprite gets "stuck" to the mouse). If I go back to:
everything works as expected but I still can drag the Sprite
anywhere I want. This is not the desired behavior. Here is some
code to test that this is the case on other systems, here: