Development Flex


    
    xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark"
    creationComplete="srv.send()" height="600">
    
        
                    url="http://aspexamples.adobe.com/chart_examples/medals-xml.aspx" />
        
    

     
         
        import mx.collections.ArrayCollection; 
        import mx.events.DragEvent; 
        import mx.controls.List; 
        import mx.managers.DragManager; 
        import mx.core.DragSource; 
        import mx.charts.chartClasses.ChartBase; 
        import mx.charts.ChartItem; 
        import mx.charts.events.ChartItemEvent; 
        import mx.charts.series.items.ColumnSeriesItem; 
        private function doDragEnter(event:DragEvent):void { 
            var dragTarget:TextArea = TextArea(event.currentTarget); 
            DragManager.acceptDragDrop(dragTarget); 
        } 
        private function doDragDrop(event:DragEvent):void { 
            var dropTarget:TextArea = TextArea(event.currentTarget); 
            var curItem:ColumnSeriesItem = ColumnSeriesItem(event.dragSource.dataForFormat("chartitems")[0]); 
            var curSeries:ColumnSeries = ColumnSeries(curItem.element); 
            var medalType:String = curSeries.displayName; 
            var numMedals:String = curItem.yValue.toString(); 
            var countryName:String = curItem.item.country; 
            ta1.text = countryName + " earned " + numMedals + " " + medalType + " medals."; 
        } 
      
    

    
        
    

    
        
            
        

                    dataProvider="{srv.lastResult.data.result}" selectionMode="single"
            dragEnabled="true">
            
                
            

            
                                    yField="gold" displayName="Gold" selectable="true" />
                                    yField="silver" displayName="Silver" selectable="true" />
                                    yField="bronze" displayName="Bronze" selectable="true" />
            

        
        
            
                            dragEnter="doDragEnter(event)" dragDrop="doDragDrop(event)" />