The data object that got dropped ends up in the dataProvider, and the
Image will pull a value from that dataObject based on labelField or
labelFunction of the HList

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Carlo Gulliani
Sent: Tuesday, May 13, 2008 12:57 AM
To: Flexcoders
Subject: [flexcoders] dragAndDrop in DataGrid and HList? How?

 

good time, everybody, i have two components: DataGrid and HList. I wanna
move item from datagrid to hlist, it's ok, all working.

<mx:DataGrid width="100%" height="500" id="dg" dragEnabled="true">
                <mx:columns>
                    <mx:DataGridColumn dataField="Name" sortable="false"
width="150" itemRenderer="components.libItem"/>
                </mx:columns>
</mx:DataGrid>

<mx:HorizontalList width="100%" height="85%" 
dropEnabled="true" dragDrop="dragDropHandler(event)" 
id="wrk" itemRenderer="mx.controls.Image"/>

and my code:

var _IMGDIR:String = "e:\\test\\";
private function dragDropHandler(e:DragEvent):void{
    if(e.dragInitiator == lib.dg){
        var items:Array = e.dragSource.dataForFormat("items") as Array;
        var path:String = String(_IMGDIR+"\\"+items[0].Name)
        trace(path); // all right, i've get
e:\test\path_of_my_picture.jpg
       // now I wanna to set value to my Image's source property
       wrk.data.source = path;
    }
}

but how to set property source value, which i getting from trace?

 

 

Reply via email to