Thursday, July 8, 2010

flex sprite startDrag bounds

There is a method in the Sprite class
named startDrag.
One of its parameters is bounds:Rectangle.

Now, when I first tried to use it I thought,
it specified the bounds of the complete sprite,
i.e. the rectangle inside which the sprite will
be forced to stay.

1. But it is actually the bounding rectangle for the 
topLeft point of the sprite.

So, during the dragging, the topLeft point of the sprite
will be forced to stay in this rectangle.

2. Also, the x & y for the bounding rectangle are wrt
 to the parent of sprite.

3. Also, if you have applied some scaling transformations on 
your sprite, you should take that into account while specifying
x,y,width,height for your bounding rectangle.






No comments:

Blog Archive