Setting y limits for mousewheel scroll of a movieclip (html5 canvas)
I have created a mousewheel scroll for a movieclip to move in the y direction, however I want it to stop at the bottom and top of the movieclip. Currently, it just scrolls forever. This is html5 canvas
-------------------------------
My script is:
canvas.addEventListener("mousewheel", scrollMC.bind(this));
function scrollMC(event) {
if (event.wheelDelta < 0 || event.detail < 0 ) {
this.myMovieclip.y-=20;
}
else if (event.wheelDelta > 0 || event.detail > 0 ) {
this.myMovieclip.y+=20;
}
}
-----------------------
Thank you for your help!
