Flex/AS3 拖放 - 自定义拖放反馈 [英] Flex/AS3 Drag Drop - Custom Drop Feedback
问题描述
我正在使用 HorizontalList
组件来显示图像列表,您可以从另一个组件拖动图像加入列表,这一切正常.
I am using a HorizontalList
component to display a list of images, you can drag images from another component to join the list, this all works fine.
如果我执行 list.showDropFeedback(event)
我会在 HorizontalList
中的图像顶部看到一个难看的黑条 - 我真正想要的是一条线到图像的左侧/右侧,新人实际坐在的位置.
If I do list.showDropFeedback(event)
I get an unsightly black bar at the top of images in the HorizontalList
- what I really want is a line to the left/right of the image, where the new one will actually sit.
我想我需要定义一个自定义 DropFeedback 来覆盖默认值.有谁知道是否有办法实现这一目标?
I guess I need to define a custom DropFeedback to override the default. Does anyone know if there there is a way to achieve this?
谢谢!
推荐答案
你可以通过覆盖 showDropFeedback() 方法来解决它.我的代码如下:
Yuo can sove it by overriding showDropFeedback() method. My code below:
import mx.controls.HorizontalList;
import mx.controls.listClasses.IListItemRenderer;
import mx.core.mx_internal;
import mx.events.DragEvent;
use namespace mx_internal;
public class HList extends HorizontalList
{
public function HList()
{
super();
}
override public function showDropFeedback(event:DragEvent):void
{
super.showDropFeedback(event);
dropIndicator.setActualSize(rowHeight - 4, 4);
DisplayObject(dropIndicator).rotation = 90;
}
}
这篇关于Flex/AS3 拖放 - 自定义拖放反馈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!