-
1. Re: Move in y-axis until user stops holding down button?
heathrowe Jan 29, 2014 5:08 PM (in response to rossfranks)Replace your Original Stage trigger action code with this; Comments is appended to the code;
/* Your Original Code
sym.getComposition().getStage().getSymbol('lab_items').$('btn').bind('mousedown touchstart',function(e){
sym.getComposition().getStage().getSymbol('lab_items')
.getSymbol('numbers')
.$('labMarks')
.animate({'top':'-=50px' }, 300, 'linear');
});
End Your Original Code*////////// New Code //////////
// Use a function to hold the continuous scroll animate method.
// The trick here is with the last parameter scrollCont.
// Which essentially calls the function (itself) over and over,
// looping, until mouseup is triggered later
function scrollCont(){
sym.getComposition().getStage().getSymbol('lab_items')
.getSymbol('numbers')
.$('labMarks')
.animate({'top':'-=50px' }, 300, 'linear', scrollCont);
}// Function to stop() the continuous scrolling when
// mouseup is trigger, later
function stopScroll(){
sym.getComposition().getStage().getSymbol('lab_items')
.getSymbol('numbers')
.$('labMarks').stop();
}// Your mousedown touchstart still applies; the addition event
// chaining the mouseup touchend; which
// when triggered will fire the stopScroll() function.
sym.getComposition().getStage().getSymbol('lab_items').$('btn').bind('mousedown touchstart',function(e){
scrollCont();
}).bind('mouseup touchend', function(e) {
stopScroll();
});////// End New Code ///////
hth
Darrell
-
2. Re: Move in y-axis until user stops holding down button?
rossfranks Jan 29, 2014 8:37 PM (in response to heathrowe)You are the man!
Exactly what I was after and so simple to understand, thanks bigtime heathrowe !!!



