MACROMEDIA FLEX BUILDER-USING FLEX BUILDER Uživatelský manuál Strana 26

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 39
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 25
16. Create the event handlers for the Save, Delete, and Cancel buttons that display when the user edits an account record Use the
following functions:
onEditSaveClickCommits the updated object to the local database.
onEditDeleteClickDeletes the record from the local database, updates the status, and displays a toaster alert.
onEditCancelClickCancels the current edit operation.
The code should like this:
protected function onEditSaveClick() : void {
_app.setStatus( null );
// The existing account object has been updated in memory.
// Now commit the updated object to the database.
_editFieldContainer.fieldCollection.updateObject(
new mx.rpc.Responder( commitToDB, saveFaultHandler )
);
}
protected function onEditDeleteClick() : void {
_app.setStatus( null );
var account : Account = Account(
_editFieldContainer.fieldCollection.managedObject
);
// clear and go back to empty mode
_editFieldContainer.fieldCollection.clear();
currentState = "default";
_desktopWrapper.deleteItem( account )
var status : F3Message = new F3Message(
F3Message.STATUS_INFO,
"Account deleted"
);
// Show the message in the status bar.
_app.setStatus( status );
// Show the toaster.
_app.showToaster(
new Toaster(
StaticAssets.REPORT_IMAGE_32,
"Account deleted",
status.description
)
);
}
protected function onEditCancel() : void {
_app.setStatus( null );
// clear and go back to empty mode
_editFieldContainer.fieldCollection.clear();
22
Step 8: Create the Account Manager User Interface and
Application Logic
Zobrazit stránku 25
1 2 ... 21 22 23 24 25 26 27 28 29 30 31 ... 38 39

Komentáře k této Příručce

Žádné komentáře