Okay, I believe my problem is solved, I never did think that after I got
my first programming job that I would have moments where I felt like a
complete and utter moron sometimes. While experimenting with where to
put the placeholder trace statements which stand in for the actual
function calls to either insert or update database records, I discovered
just the right spot to put the insert function call as demonstrated in
this code:

private function dragToOrders(event:DragEvent):void
{
     var draggedItems:Object = new Object();
     draggedItems =  event.dragSource.dataForFormat("items");
     var n:int = orderDetailArray.length;
        for (var i:int = 0; i < n; i++)//Looping through to check for
duplicate entries
        {
          if (orderDetailArray[i].UniqueID == draggedItems[0].UniqueID)
           {
             orderDetailArray[i].Qty ++;
             orderDetailArray.itemUpdated(orderDetailArray[i]);
             trace("Fire update statement on " + i);//Placeholder for
update function call
             event.preventDefault();
             return;
           }
        }
        trace("Inserted New Record");//Placeholder for insert function
call
}

In this final incarnation when debugged, the insert statement as
represented by the trace statement is fired only when a new item is
dragged and dropped onto the target, and the update statement as
represented by its trace statement works just fine as well. If anyone
finds any problems with this, then please don't hesitate to let me know.

Brian Ross Edwards
Tech-Connect LLC


Reply via email to