开发者

Clamp MovieClip to only be draggable inside 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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜