Here is some source code that basically shows what I'm doing. It is not my actual source code, because that has a ton of other irrelevant crap. But it does replicate the experience pretty closely. I have commented out the part where I'm trying to figure out what to set the X/Y to. If you have some wild guesses, I'd suggest trying them before posting. ;) Believe me, I've thought of about a dozen things (like subtracting the renderers width off the X - won't work cause it isn't set) and all have been dead ends.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="vertical">
<mx:Script>
<![CDATA[
import mx.controls.DataGrid;
import mx.controls.Label ;
import mx.containers.Canvas;
import mx.collections.ArrayCollection;
import mx.core.DragSource;
import mx.managers.DragManager;
[Bindable] public var provider:ArrayCollection = new ArrayCollection([{label:"one"}, {label:"two"}, {label:"three four five"}]);
private function startGridDrag(event:MouseEvent):void {
if (event.buttonDown) {
var dragInitiator:DataGrid = DataGrid(event.currentTarget);
var ds:DragSource = new DragSource();
var row:Object = dragInitiator.selectedItem;
if (row != null) {
var draggedItem:Object = {label:row.label};
var renderer:Canvas = new Canvas;
var lbl:Label = new Label;
renderer.addChild(lbl);
lbl.text = row.label;
//renderer.x = ????
//renderer.y = ????
ds.addData([draggedItem], 'items');
DragManager.doDrag(dragInitiator, ds, event, renderer);
}
}
}
]]>
</mx:Script>
<mx:DataGrid id="grid" dataProvider="{provider}" width="200" height="200" mouseMove="startGridDrag(event)">
<mx:columns>
<mx:DataGridColumn headerText="label">
<mx:itemRenderer>
<mx:Component>
<mx:Canvas>
<mx:Label text="{ data.label}" color="blue"/>
</mx:Canvas>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
<mx:List dropEnabled="true" width="200" height="200"/>
</mx:Application>
--
Jason __._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
| Web site design development | Computer software development | Software design and development |
| Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

