The drag and drop example in Flex samples explorer allows you to drag several 
rows from a datagrid to another, you might find what you want in there
http://flexapps.macromedia.com/flex15/explorer/explorer.mxml?versionChecked=true
Quick tour >> drag and drop

________________________________

From: [email protected] on behalf of More García
Sent: Tue 29/11/2005 14:59
To: [email protected]
Subject: [flexcoders] Drag 'n' drop multiple items at one time


Hi. I have a mx:tilelist with multiple photos. I have implemented 
drag'n'drop funcionality, that let you can drag photos to one folder 
(mx:Image). But the problem is that i need drag more than one photo 
at one time. Any idea how i can do? 


The sample code: 

<!-- The script to drag -->

<mx:Script>
      <![CDATA[
      
            // Import the DragManager and DragSource classes.
            import mx.managers.DragManager;
            import mx.core.DragSource;
            
            // Handle the drag initialization for the Canvas 
containers.
            //in the mouseDown event
            function dragIt(event, text, format) {
                  var ds:DragSource = new DragSource();
                  ds.addData(text, format);
                  
                  DragManager.doDrag(event.target, ds, 
thumbnail,
{element:event.target.element,thumb:event.target.thumb,backgroundColor
:'#B7F39B', width:80, height:80},undefined, undefined, 30);
            }

            // Handle the dragEnter event for the List controls.
            function doDragEnter(event, format) {
                  if (event.dragSource.hasFormat(format) || 
format == "any"){
                        event.handled = true;
                        event.target.drawFocus(true);
                  }
            }

            // Handle the dragExit event for the List controls.
            function doDragExit(event) {
                  event.dragSource.dataForFormat("img").alpha = 
10;
                  event.target.drawFocus(false);
            }
            // Handle the dragOver event for the List controls.
            function doDragOver(event) {                  
                  if (Key.isDown(Key.CONTROL))
                        event.action = DragManager.COPY;
                  else if (Key.isDown(Key.SHIFT))
                        event.action = DragManager.LINK;
                  else
                        event.action = DragManager.MOVE;
            }
            // Handle the dragDrop event for the List controls.
            function doDragDrop(event, target, formats) {
                  // Since the drag is over, remove focus from 
the target.                                    
                  doDragExit(event);
            }
      ]]>
      </mx:Script>

<!-- The tilelist with cellRenderer -->
<mx:Panel id="pResultsMosaic" title="" width="78%" height="100%">
     <mx:TileList id="tlResults"
      height="100%"
      width="100%"
      itemWidth="80"
      itemHeight="80"                        
      multipleSelection="true"
      cellRenderer="thumbnail"
      dataProvider="{elemento}">
     </mx:TileList>
</mx:Panel>
<!-- The target folder -->
<mx:Image source="@Embed('img/trash.png')" width="28" height="28"
                              alpha="50" toolTip="Send to 
trash!"
                              dragEnter="doDragEnter
(event,'img')"
                              dragExit="doDragExit(event);"
                              dragOver="doDragOver(event);"
                              dragDrop="doDragDrop
(event,undefined,'img')"/>
                        <mx:Label text="Trash"></mx:Label>


<!-- thumbnail.mxml -->

<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.macromedia.com/2003/mxml";
      horizontalAlign="center"
      verticalGap="0"       
      hScrollPolicy="off" 
      vScrollPolicy="off"
      borderStyle="solid"
      borderColor="#F1F1F1" mouseDown="_root.dragIt(event, 
this, 'img')">

      <mx:Script>
      <![CDATA[
            var element:Object;
            var thumb:Object;

            function setValue(str: String, item: Object) {
                  if (item==undefined) {
                        visible = false;
                        return;
                  } else {
                        element = item;
                        thumb = element.THUMB;            
                        visible = true;
                  }
            }        
      ]]>
      </mx:Script>

      <mx:Effect>
            <mx:Fade alphaFrom="0" alphaTo="100" name="alphaUp" 
duration="500"/>              
      </mx:Effect>


      <mx:Loader id="image"            
            source="{thumb.toString()}"
            horizontalAlign="center" 
            verticalAlign="middle"
            scaleContent="true"
            width="100%"
            height="100%"
            alpha="0"
            resizeEffect="alphaUp" /> 
            
      <mx:Label id="filename" text="{element.filename}" 
width="100%" height="20" textAlign="center"/>
</mx:VBox>









--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 



________________________________

YAHOO! GROUPS LINKS 


        
*        Visit your group "flexcoders 
<http://groups.yahoo.com/group/flexcoders> " on the web.
          
*        To unsubscribe from this group, send an email to:
         [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 
          
*        Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service 
<http://docs.yahoo.com/info/terms/> . 


________________________________



------------------------------------------------------------------
**STATEMENT OF CONFIDENTIALITY** 

This e-mail and any attached files are confidential and intended solely for the 
use of the individual to whom it is addressed. If you have received this email 
in error please send it back to the person that sent it to you. Any views or 
opinions presented are solely those of author and do not necessarily represent 
those the Emakina Company. Unauthorized publication, use, dissemination, 
forwarding, printing or copying of this email and its associated attachments is 
strictly prohibited.

We also inform you that we have checked that this message does not contain any 
virus but we decline any responsability in case of any damage caused by an a 
non detected virus.
------------------------------------------------------------------



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page
http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

<<winmail.dat>>

Reply via email to