I had tried that as well:

public function handleSelectedItemsDragComplete(e:DragEvent):void {
  var copy:* = ObjectUtil.copy(DataGridItemRenderer(e.draggedItem).data);
  DataGridItemRenderer(e.draggedItem).data = ""> }

For some reason, the object dropped is still pointing to the same
memory location as the original. It's like the item gets dropped
before this listener is called.

I had made a mistake in my initial post. I'm calling this handler on
the dragDrop event but I've also called it on dragComplete (which
doesn't even seem to call the handler.. my debugger never hits the
breakpoint). I also tried it on dragEnter but the draggedItem is null
at that point for some reason.



--- In flexcoders@yahoogroups.com, "jeremy lu" <[EMAIL PROTECTED]> wrote:
>
> yes, you can.
>
> import mx.utils.ObjectUtil;
>
> var myCopy:* = ObjectUtil.copy( originalObject );
>
> then you got a copy of original object.
>
> btw, if you check the source you will find it's done by ByteArray so
> internal structure are kept after copying.
>
> Jeremy.
>
> On 5/19/06, yomahz <[EMAIL PROTECTED]> wrote:
> >
> > Is there a way to copy the object by value instead of reference upon
> > drag and drop? I'd like to make a copy of the object being dropped
> > into the new container so that changes made to it, do not effect the
> > original.
> >
> > I tried implementing a handler on dragComplete as such:
> >
> > public function handleSelectedItemsDragComplete(e:DragEvent):void {
> > Object(e.draggedItem).data = ""> > > }
> >
> > This doesn't seem to work and I'm not sure why. When I make updates to
> > DataGrid A, it still effects DataGrid B.
> >
> > Is there a better way to accomplish this?
> >
> >
> >
> >
> >
> >
> > --
> > 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
> >
> >
> >
> >
> >
> >
> >
> >
>








--
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
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to