I just realized this is something that was done in the Flex Store sample, if you have the Flex samples installed, you should be able to find the necessary code in there.
 
Otherwise I found this in FlexCoders archive (Manish was there again ;)) : http://www.mail-archive.com/[email protected]/msg07873.html
 
Couldn't resist to give it a try with an image, here's the updated code (you need to specify your own images in the dataProvider >> img):
 
1°) index.mxml
--------------
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
  xmlns="*" backgroundColor="white">
  <MyTree id="myTree" dragEnabled="true">
    <dataProvider>
      <mx:Array>
        <mx:Object label="foo" img="icon.jpg" />
        <mx:Object label="bar" img="icon2.jpg"/>
      </mx:Array>
    </dataProvider>
  </MyTree>
</mx:Application>
 
2°) MyTree.as
------------
class MyTree extends mx.controls.Tree
{
      function get dragImage()
      {
            return MyDragProxy;
      }
}
 
3°) MyDragProxy.as
-------------------
class MyDragProxy extends mx.controls.listclasses.DragProxy
{
 public function createChildren():Void
 {
  super.createChildren();
  var target = mx.core.Application.application.myTree;
  var myImg = target.selectedNode.backingObject.img;
  var myLabel = target.selectedNode.backingObject.label;
  var label = createClassObject(mx.controls.Label, "zeLabel", getNextHighestDepth(), {text: myLabel, y:20});
  var myImg = createClassObject(mx.controls.Image, "zeImage", getNextHighestDepth(), {source: myImg, y:40})
 
 }
}
 
 
Philippe Maegerman

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Philippe Maegerman
Sent: lundi 22 août 2005 14:42
To: [email protected]
Subject: RE: [flexcoders] Re: A big problem for a big beginner (drag'ndrop with create child)

I think you should investigate the dragProxy class
http://livedocs.macromedia.com/flex/15/asdocs_en/mx/controls/listclasses/DragProxy.html
 
Philippe Maegerman


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of sojiro59
Sent: lundi 22 août 2005 14:12
To: [email protected]
Subject: [flexcoders] Re: A big problem for a big beginner (drag'ndrop with create child)

I want to make a copy of the image in order to move this copy on the
container representing the planning and to keep the image in the list
of the activities.

I know that i need to develop solution with createchild or
createclassobject to do this but i don't succeed.

--- In [email protected], Krzysztof Szlapinski <[EMAIL PROTECTED]>
wrote:
>
> > When i click on a image, i wanted to make a copy of this image which
> > has been created in order to be drag'n drop in another container.
>
> do you want to make the copy of an image object?
> maybe just pass an this image's url in a string and create another
image
> object when the dragging is finished with the passed url as a soure?
>
> greetz
> krzysiek
>
> >
> >
> >
> >
> > --
> > 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
> >
> >
> >
> > 
> >
> >
> >
> >


------------------------------------------------------------------
**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.
------------------------------------------------------------------



--
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
Computer software testing Macromedia flex Development
Software developer


YAHOO! GROUPS LINKS




Reply via email to