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

  • 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 15
</mx:Form>
<mx:ProgressBar
visible="{app.loginPending}"
indeterminate="true"
label="{statusMessage}"/>
</s:Panel>
2. Replace the default ActionScript code in the Script component with the following code, which is similar to the default code but
has logic to handle status changes.
import com.salesforce.events.LoginFaultEvent;
import com.salesforce.events.LoginResultEvent;
import com.salesforce.events.SessionExpiredEvent;
import com.salesforce.events.StatusChangedEvent;
import mx.controls.Alert;
[Bindable]
private var statusMessage : String = "";
private var _username : String;
private var _password : String;
protected function loginClickHandler( event : MouseEvent ) : void {
_username = username.text;
_password = password.text;
app.loginByCredentials( _username, _password );
}
protected function statusChangedHandler( event : StatusChangedEvent ) : void {
trace( "status change: " + event.message.description );
statusMessage = event.message.description;
}
protected function loginFailedHandler( event : LoginFaultEvent ) : void {
event.preventDefault();
Alert.show( event.faultString, "Login failed." );
currentState = "login";
}
protected function loginCompleteHandler( event : LoginResultEvent ) : void {
currentState = "main";
}
protected function sessionExpiredHandler( event : SessionExpiredEvent ) : void {
// Alert will be shown if default is not prevented.
event.preventDefault();
app.loginByCredentials( _username, _password );
}
3. Add the AccountsView component to the end of the Main.mxml file, just before the closing WindowedApplication
tag. Your local namespace includes this component. The component does the following:
12
Step 7: Create the Account Manager Login Screen
Vue de la page 15
1 2 ... 11 12 13 14 15 16 17 18 19 20 21 ... 38 39

Commentaires sur ces manuels

Pas de commentaire