I'm trying to get amfphp to work for simple database editing. It selects and displays records in a datagrid fine, and when I select one and click a Delete button, it gets deleted from the database, but my onDeleteScore function is not called (even though the NC debugger shows Result: (boolean) true). I'm not sure how to set up the service and pending call variables when multiple operations are done -- do you create one service object and one pendingCall object and then assign different relayResponder objects to the pc.responder each time a new operation is done? Or should a new pendingCall object be created for each operation? (or a new service object altogether?) I tried a variety of different ways and never can get my onDeleteScore function to be called. Code for the delete part:

// this is never called
function onDeleteScore(re:ResultEvent) {
   trace('result='+re.result);
   scores_dg.removeItemAt(deleteIndex);
   msg_ta.text = "Record was deleted";
}

function deleteRecord() {
   // remember which element of the array is to be deleted
   deleteIndex = scores_dg.selectedIndex;
   // get the id of the record to delete, to pass it to deleterecord.php
   var id:Number = scores_dg.selectedItem.record;
// (tried new pc and same pc used for select operation -- neither worked)
   var pc:PendingCall  = _service.deleteScore(scores_dg.selectedItem.id);
   pc.responder = new RelayResponder(this, "onDeleteScore", "onDbError");
}

delete_btn.addEventListener("click", deleteRecord);

thanks for any suggestions/advice,
Helen



_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to