Robotlegs with MXML and Starling - sharing MOUSE_WHEEL

andreas's Avatar


13 Feb, 2013 11:11 PM


I am developing a desktop browser game that uses Starling (which only knows touch events) and Spark components. I want my Starling components to know about the mouse wheel-event. Everything is connected using Robotlegs V2.
So I am thinking about listening for the MOUSE_WHEEL-event on the stage of the flex-Application and dispatch this using a Mediator:

view.stage.addEventListener(MouseEvent.MOUSE_WHEEL, eventDispatcher.dispatchEvent);
The Mediator of my Starling view catches this event and reacts on this:
addContextListener(MouseEvent.MOUSE_WHEEL, view.mouseWheel);
But that somehow feels wrong. Does anyone here have an idea if and how this could be implemented nicer?

(Besides that, it is not working, because I can not even mediate my Application-view, see my other post: ).

  1. Support Staff 1 Posted by Ondina D.F. on 14 Feb, 2013 09:52 AM

    Ondina D.F.'s Avatar

    Ideally, your view should dispatch a custom event in the handler of MouseEvent.MOUSE_WHEEL event. The mediator would re-dispatch the custom event, and if another mediator needs to listen to it, it would add a context listener for the custom event.
    [The custom event should override the clone() method, in order to get re-dispatched]

  2. 2 Posted by andreas on 14 Feb, 2013 03:40 PM

    andreas's Avatar

    Thanks again, Ondina! You are the best!
    With your comment on the Mediator in the other post I got this working, but I changed it to use a a custom event as you suggested.

  3. andreas closed this discussion on 14 Feb, 2013 03:40 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac