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>
------------------------ 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/