Yup!
----- Original Message -----
From: "Helen Triolo" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <[email protected]>
Sent: Wednesday, December 21, 2005 2:26 PM
Subject: Re: [Flashcoders] amfphp database editing question
Thanks for the reply! As I was typing in more explanation, I realized
what was wrong. This
delete_btn.addEventListener("click", deleteRecord);
should be
delete_btn.addEventListener("click", Delegate.create(this,
deleteRecord)); to make the scope right to find onDeleteScore.
Made the change and it works. So in general, it's correct to create a
single Service instance and then use a different PendingCall instance
for each operation?
Helen
JesterXL wrote:
>This is correct:
>
>var pc:PendingCall = _service.deleteScore(scores_dg.selectedItem.id);
>pc.responder = new RelayResponder(this, "onDeleteScore", "onDbError");
>
>However, not sure why your result/fault functions aren't getting called,
>even weirder is your seeing the NCD saying it did. Your code that you've
>posted looks good. Are those functions defined in the same place, you just
>didn't post 'em?
>
>----- Original Message -----
>From: "Helen Triolo" <[EMAIL PROTECTED]>
>To: "Flashcoders Mailing List" <[email protected]>
>Sent: Wednesday, December 21, 2005 2:01 PM
>Subject: [Flashcoders] amfphp database editing question
>
>
>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
>[email protected]
>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
>_______________________________________________
>Flashcoders mailing list
>[email protected]
>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
>
>
>
--
Helen Triolo
Flash Programmer/Instructor, Web Developer
http://flash-creations.com • http://i-technica.com
ph: 301.424.6037 • email: [EMAIL PROTECTED]
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders