I am trying to implement a drag and drop function between a list control and a columnchart in Flex3. List items should, when dragged and dropped on the chart, be displayed graphically in the columnchart. Alas, dropping the listitems on the chart does not seem to result in a proper graph. Here my code till so far with regard to the drop part:
private function doDragDrop(event:DragEvent):void{
var ds:DragSource = event.dragSource; var dropTarget:ChartBase=ChartBase(event.currentTarget); var items:Array = ds.dataForFormat("items") as Array;
for(var i:uint=0; i < items.length; i++)开发者_JAVA百科 { if (dropTarget.dataProvider.contains(items[i].item)) { } else { dropTarget.dataProvider.addItem(items[i].item);
} } }I am pretty new to Flex; any help is greatly appreciated!
Here is a drag and drop sample that might help:
http://flexexamples.blogspot.com/2007/12/flex-drag-and-drop-custom-class-source.html
精彩评论