Note that overriding the dragImage getter is undocumented/unsupported/use-at-your-own-risk…

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Manish Jethani
Sent: Thursday, May 26, 2005 2:07 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Using a drag proxy

 

On 5/26/05, digital_eyezed <[EMAIL PROTECTED]> wrote:

> I have a fully functioning drag and drop operation going on. All I
> want to do is add an image using the drag proxy functionality to the
> application.
>
> Here is the tree I drag from:
>
> <mx:Tree id="tree1" dataProvider="{MyService.result}" width="100%"
> height="100%" dragEnabled="true"/>
[...]

You can do it by making your own drag proxy.  See example below.

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
  xmlns="*" backgroundColor="white">
  <MyTree dragEnabled="true">
    <dataProvider>
      <mx:Array>
        <mx:Object label="foo" />
        <mx:Object label="bar" />
      </mx:Array>
    </dataProvider>
  </MyTree>
</mx:Application>

// MyTree.as
class MyTree extends mx.controls.Tree
{
      function get dragImage()
      {
            return MyDragProxy;
      }
}

//MyDragProxy.as
class MyDragProxy extends mx.controls.listclasses.DragProxy
{
      public function createChildren():Void
      {
            super.createChildren();

            var label = createClassObject(mx.controls.Label, "",
getNextHighestDepth(), {text: "Watch me move"});
            label.y += 20;
      }
}

You can put your image in createChildren()



Yahoo! Groups Links

Reply via email to