如何 startdrag() 舞台中的任何对象?
我想开始拖动位于舞台中的对象。舞台中有影片剪辑,其中也包含很多对象。当我单击任何对象时,它应该开始拖动。您有什么解决方案吗?
addEventListener(MouseEvent.MOUSE_UP, targetMC);
function targetMC(MouseEvent:Event):void
{
var curinstance = MouseEvent.target.valueOf();
curinstance.startDrag();
}
I would like to start drag objects which is located in stage.There is movie clips in the stage which also encloses so many objects.when i click on any of the object it should be startdraged..Do u have any solution?
addEventListener(MouseEvent.MOUSE_UP, targetMC);
function targetMC(MouseEvent:Event):void
{
var curinstance = MouseEvent.target.valueOf();
curinstance.startDrag();
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以将侦听器分配给持有其他资源的 MC/Sprite 或 Root
root.addEventListener(MouseEvent.MOUSE_DOWN, targetMC);
您可以添加一个全局变量来查看正在移动或迭代的对象遍历所有对象以阻止它们向上拖动鼠标
或使用 hypeframework 调整器:
http:// www.hypeframework.org/02_examples/adjuster/content/01_adjuster/
you can assign the listener to the MC/Sprite or Root that holds the other resource
root.addEventListener(MouseEvent.MOUSE_DOWN, targetMC);
you can add a global var to see what object is being moved or iterate through all objects to stop them from draging on mouse up
or use hypeframework adjuster:
http://www.hypeframework.org/02_examples/adjuster/content/01_adjuster/
这是答案
here is the answer
这就是答案............
this is the answer..........