mercredi 24 février 2016

How to Restrict the Drag option of an object within a particular area in ActionScript3

I have two Objects

  • one created with scale-factor 0.8 and with height 450 and with width 650.

  • And another one created with scale-factor 1.2 and with height 450 and with width 650

When i tried to restrict the drag option of these two objects to a certain rectangle then i found that one object (i.e first one) is moving within the given rectangle boundary but second one is not moving within the rectangle boundary that means it is also moving out side the boundary.

Following are my codes:

var rect:Rectangle = new Rectangle(200 , 0 , 800 , Capabilities.screenResolutionY);
obj.startDrag(false , rect);

I found that starting x and y co-ordinate point for the both objects are same means these are not moving below x coordinate (i.e 200) but the set width and height of the rectangle is different where i an providing same height and width for the both object.

So i don't know why it is happening like this.

Does anyone have an idea where I'm doing wrong?

Aucun commentaire:

Enregistrer un commentaire