开发者

Clamp MovieClip to only be draggable inside stage?

开发者 https://www.devze.com 2022-12-23 18:41 出处:网络
I have a MovieClip that I want the user to be able to drag inside the stage, but I don\'t want it to be able to move outside the stage.

I have a MovieClip that I want the user to be able to drag inside the stage, but I don't want it to be able to move outside the stage.

Currently I'm using this._parent.startDrag(); to allow the MC to be dragged, but I don't know how to sto开发者_JS百科p it from being dragged outside the frame.


The startDrag method has some optional parameters to constrain where you can drag, so you could use:

this._parent.startDrag(false, 0, 0, Stage.width, Stage.height);

There's a full description in the Adobe AS2 docs

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号