flex:能够拖放影片剪辑

发布于 2024-11-04 17:52:27 字数 117 浏览 5 评论 0原文

为了改善用户体验,我们希望能够拥有旋转轮的动画影片剪辑,并能够将其拖放到定义区域的任何位置。

我们已将旋转轮构建为 SWC 文件。

我们如何进行拖放。我见过的例子只满足图像的丢失。再次感谢

In order to improve user experience we want the ability to have an animated movieclip of a turning wheel- and have the ability to drag and drop it anywhere on a defined area

We have built the rotating wheel as a swc file.

How do we do the drag+drop. Examples that I have seen, cater to only dropping of images. Thanks again

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

手心的温暖 2024-11-11 17:52:27

要使用 Flex 类进行拖放,您需要将该 movieClip 包装在 UIComponent;其中包含与拖放相关的所有事件。

这里有一些好的说明。要复制相关部分:

使组件可拖动

  1. 添加 MouseEvent.MOUSE_DOWN 监听器
  2. 确定拖动发起者并将其移交给 DragManager

要启动拖放操作,您需要
组件的 MouseEvent
拖拽。

public function makeDraggable( component:IUIComponent ):void
{
   // a mouseDown event will start the drag
   component.addEventListener( MouseEvent.MOUSE_DOWN, beginDrag );
}

public function beginDrag( mouseEvent:MouseEvent ):void
{
   // the drag initiator is the object being dragged (target of the mouse event)
   var dragInitiator:IUIComponent = mouseEvent.currentTarget as IUIComponent;

   // the drag source contains data about what's being dragged
   var dragSource:DragSource = new DragSource();

   // ask the DragManger to begin the drag
   DragManager.doDrag( dragInitiator, dragSource, mouseEvent, null );
}

To use the Flex classes for drag and drop you'll need to wrap that movieClip in an a UIComponent; which has all the events related to drag and drop.

Here are some good instructions. To copy the relevant pieces:

Make a Component Draggable

  1. Add listener for MouseEvent.MOUSE_DOWN
  2. Determine drag initiator and hand-off to DragManager

To kick off a drag-n-drop, you'll need
a MouseEvent for the component to be
dragged.

public function makeDraggable( component:IUIComponent ):void
{
   // a mouseDown event will start the drag
   component.addEventListener( MouseEvent.MOUSE_DOWN, beginDrag );
}

public function beginDrag( mouseEvent:MouseEvent ):void
{
   // the drag initiator is the object being dragged (target of the mouse event)
   var dragInitiator:IUIComponent = mouseEvent.currentTarget as IUIComponent;

   // the drag source contains data about what's being dragged
   var dragSource:DragSource = new DragSource();

   // ask the DragManger to begin the drag
   DragManager.doDrag( dragInitiator, dragSource, mouseEvent, null );
}
甜嗑 2024-11-11 17:52:27

您应该为 movieClip 指定 dragProxy 来保存它的实例而不是固定图像。

You should specify the dragProxy for the movieClip to hold an instance of it instead of a fixed image.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文