window.removeEventListener doesn't work

i use this code for a scrolling effect animation in my first scene load. but when i need to desactivate in another scene with
window.removeEventListener(“mousewheel”, scrollScene);
window.removeEventListener(“DOMMouseScroll”, scrollScene);
it doesn’t work.
thank you and sorry for my english (27.1 KB)

if (window.addEventListener) {
window.addEventListener("mousewheel", scrollScene, false);
window.addEventListener("DOMMouseScroll", scrollScene, false);

function scrollScene(e){
var upORdown = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail)));
if(upORdown === 1){
hypeDocument.continueTimelineNamed(‘Main Timeline’, hypeDocument.kDirectionReverse);
reverse = 1;
//alert (reverse + ‘arriere wheel’)
//hypeDocument.showPreviousScene(hypeDocument.kSceneTransitionPushTopToBottom, 2.1)
hypeDocument.continueTimelineNamed(‘Main Timeline’, hypeDocument.kDirectionForward);
reverse = 0;
//alert (reverse + ‘avant wheel’)
//hypeDocument.showNextScene(hypeDocument.kSceneTransitionPushBottomToTop, 2.1)

window.scrollScene = function(e){.....}

and you can access it on another scene

As Hans says but make sure you set this before you call it because “scrollScene” is now a variable, for example:

window.scrollScene = function (e){
    // code as above

if (window.addEventListener) {
    window.addEventListener("mousewheel", window.scrollScene, false);
    window.addEventListener("DOMMouseScroll", window.scrollScene, false);

:slight_smile:it’s work, thank you very much !!
I don’t find documentation about the organisation, the range and how working the function that were written directly in hype ?