MACROMEDIA FLEX BUILDER-USING FLEX BUILDER Manuel d'utilisateur Page 27

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 39
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 26
currentState = "default";
}
17. Create the event handlers for the Save and Cancel buttons that display when the user is creating an account record. The
onCreateSaveClick function commits the new object to the local database. The function onCreateCancelClick
named cancels the current create operation. The code should like this:
protected function onCreateSaveClick() : void {
_app.setStatus( null );
// The new account object has been created in memory.
// Now commit the new object to the database.
_createFieldContainer.fieldCollection.updateObject(
new mx.rpc.Responder( commitToDB, saveFaultHandler )
);
}
protected function onCreateCancelClick() : void {
_app.setStatus( null );
// clear and go back to empty mode
_createFieldContainer.fieldCollection.clear();
currentState = "default";
}
18. Add the following ActionScript functions:
saveFaultHandlerHandles errors for invalid fields.
commitToDBCommits the data in memory to the local database and clears the data from the FieldContainer.
onDataGridItemClickRenders the UI and alerts for editing an account.
onQueryResultStores the results of the query and updates the status.
onToasterSelectedUsed when displaying toaster alerts.
The code should like this:
protected function saveFaultHandler( msg : F3Message ) : void {
// If there are invalid fields, stay on the edit screen
// so the user has a chance to fix the errors.
// Otherwise, clear the record.
if (
msg != null &&
msg.messageType != F3Message.ERROR_INVALID_FIELDS
) {
currentState = "default";
}
if ( msg != null ) {
var faultEvent : FaultEvent = msg.context as FaultEvent;
if ( faultEvent ) {
LOG.error( faultEvent.fault.faultString );
LOG.error( faultEvent.fault.faultDetail );
LOG.error( faultEvent.fault.faultCode );
}
}
23
Step 8: Create the Account Manager User Interface and
Application Logic
Vue de la page 26
1 2 ... 22 23 24 25 26 27 28 29 30 31 32 ... 38 39

Commentaires sur ces manuels

Pas de commentaire