loover

How to add mouse wheel callback only for specific sprite/group?

Recommended Posts

Scrolling it. I have a two "screens" (group with sprites). Like a list with many items. Some items are hidden and scrolling using for reveal they. Need to achieve the scrolling if user use scroll wheel in any place on the screen.

But if first screen is hidden (alpha = 0, x = -10000, for example) and user try to scrolling the another one - list on the first screen scrollied also.

Share this post


Link to post
Share on other sites

You can add the screens/list to some array, then iterate trough that array to check if some condition is met when the mouseWheelCallback is executed:

The example can also check if mouse is hovering over some list, see commented code inside scroll().

Share this post


Link to post
Share on other sites

So impossible to have the different mouse wheel callbacks for different sprites/groups?

Is possible to add the mouse wheel functionality to different list classes? E .g. to have an own callback for different instances of this class.

Share this post


Link to post
Share on other sites

Hi Loover, can you explain how you did it? I have used mousewheelcallback on input over of each sprites. But it is still working on input out. I have added function in input out to remove input over events. Still its catching mousewheelcallback. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.