onWheel event question

Good morning,

I wonder how should be possible to know if I’m wheeling up or down.

If I run this script

    
    deltaMode = 0
    deltaY = 2
    deltaX = 5
    deltaZ = 10
    
    system.perspective.print(deltaX)
    system.perspective.print(deltaY)
    system.perspective.print(deltaZ)

I have these results in the browser

5
2
10
5
2
10

In the first case I scroll up the wheel, in the second I scroll down.

On what event are you running the provided script?

Actually I try running it on the main flex of a view.

I meant like on what event were you trying to run the script that you provided. i.e(onWheel, onClick)

I tried this in onWheel event:


def runAction(self, event):
		
	verticalScroll = event.deltaY
	
	if verticalScroll > 0:
		system.perspective.print("Scroll Down")
	elif verticalScroll < 0:
		system.perspective.print("Scroll Up")

Hope this is what you are looking for.

1 Like

Yes thank you, this is what I need.