Question

Récemment je donne un autre coup Dashcode;)

Il est génial. Est juste que je pense est pas bien documenté. J'ai un objet stackLayout avec seulement deux vues en elle, et quelques boutons qui échangent les vues avec une transition. (Vues montrent les données d'un grand tableau, list) Animations et transitions travail parfait. Le problème est, quand j'appuie sur un bouton tout en animant l'animation recommence et il semble laid (Si j'avais n vues pour un tableau de longueur n DataSource ce should't un problème, mais ce n'est pas mon cas).

Je veux désactiver les boutons pendant que l'animation est en cours.

Y at-il rappel, délégué, ou tout autre moyen que je peux obtenir une notification lorsque l'animation est terminée?

est ce que je l'ai fait:

function _changeView(transitionDirection, newIndex){

    //Create transition
    var newTransition = new Transition(Transition.SWAP_TYPE, 0.9, Transition.EASE_TIMING);
    newTransition.direction = transitionDirection;

    //I only have two views. I use currentView's id to calculate not current view id and change text inside of it. 
    var stackLayout = document.getElementById('stackLayout').object;//stackLayout object
    var nextViewId = (stackLayout.getCurrentView().id == 'view1')? '2':'1'; //

    //change the text in the view that is going to appear   
    document.getElementById('text'+nextViewId).innerHTML = list[curIndex];

    stackLayout.setCurrentViewWithTransition('view'+ nextViewId, newTransition, false);
}

function goPrevious(event)
{
    curIndex--;
    if(curIndex < 0){ 
        curIndex = list.length-1;
    }
    _changeView(Transition.LEFT_TO_RIGHT_DIRECTION, curIndex);
}

function goNext(event)
{
    curIndex++;
    if(curIndex >list.length - 1){ 
        curIndex = 0;
    }
    _changeView(Transition.RIGHT_TO_LEFT_DIRECTION, curIndex);
}
Était-ce utile?

La solution

Finalement trouvé la réponse à cette question. Voici comment je l'ai fait:

document.getElementById('stackLayout').object.endTransitionCallback=function(stackLayout, oldView, newView) {
    //PUT CODE HERE USING stackLayout, oldView, newView to show params
}

En fait, vous pouvez trouver toutes les méthodes stackLayout et propriétés dans le fichier StackLayout.js dans votre projet !!

Hope this helps

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top