with the copy of the object which is why I'm having my problem. The
solution would be to copy the whole draggedItem (DataGridItemRenderer)
instead of it's data property. The problem is:
e.draggedItem = DataGridItemRenderer(ObjectUtil.copy(e.draggedItem));
causes an exception:
ArgumentError: Error #2004: One of the parameters is invalid.
at
mx.utils::ObjectUtil$/copy()[C:\dev\beta3\sdk\frameworks\mx\utils\ObjectUtil.as:91]
at
com.sonicdrivein.ifc.inventory.controller::InventoryEditController/handleSelectedItemsDragDrop()[C:\dev\workspace\flex\IdealFoodCost\trunk\InventoryEditor\src\com\sonicdrivein\ifc\inventory\controller\InventoryEditController.as:147]
at
InventoryEditor/__selectedItemsDataGrid_dragDrop()[C:\dev\workspace\flex\IdealFoodCost\trunk\InventoryEditor\src\InventoryEditor.mxml:37]
at flash.events::EventDispatcher/dispatchEvent()
at
DragManager.as$166::DragProxy/mouseUpHandler()[C:\dev\beta3\sdk\frameworks\mx\managers\DragManager.as:1124]
--- In [email protected], "yomahz" <[EMAIL PROTECTED]> wrote:
>
> 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 [email protected], "jeremy lu" <wade.lu@> 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 <yomahz@> 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
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

