javascript - More control when doing animations in Dashcode/Dashboard? -
recently giving shot dashcode ;)
it's great. think not documented. have stacklayout object 2 views in it, , couple of buttons interchange views transition.(views show data of large array, list
) animations , transitions work perfect. problem is, when press button while animating animation starts again , looks ugly (if had n views datasource array of length n should't problem, not case).
i want disable buttons while animation taking place.
is there callback, delegate, or way can notification when animation finished?
this have done:
function _changeview(transitiondirection, newindex){ //create transition var newtransition = new transition(transition.swap_type, 0.9, transition.ease_timing); newtransition.direction = transitiondirection; //i have 2 views. use currentview's id calculate not current view id , change text inside of it. var stacklayout = document.getelementbyid('stacklayout').object;//stacklayout object var nextviewid = (stacklayout.getcurrentview().id == 'view1')? '2':'1'; // //change text in view going 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); }
eventually found answer this. here's how did it:
document.getelementbyid('stacklayout').object.endtransitioncallback=function(stacklayout, oldview, newview) { //put code here using stacklayout, oldview, newview show params }
in fact can find stacklayout methods , properties in stacklayout.js file in project!!
hope helps
Comments
Post a Comment