Away3D and Robotlegs : How to have a MouseEvent3D Fired??

poq2011's Avatar


16 Feb, 2013 05:13 PM

Hi all

I am trying to use Robotlegs with Away3D. I am using the Robotlegs Away3D 4 integration by Paul Tondeur.

I am trying to have a MouseEvent3D.MOUSE_OVER fired when the mouse is over a 3D Object. I though that registering the event with the following line of code

eventMap.mapListener(object3D, MouseEvent3D.MOUSE_OVER, onMeshMouseOver);

in a class extending the Mediator3D would suffice by apparently it doesn't work

As I am a Robotleg newbie, I must miss something. Would someone have a clue of what I am doing wrong?

  1. Support Staff 1 Posted by Ondina D.F. on 17 Feb, 2013 11:05 AM

    Ondina D.F.'s Avatar

    Hi aeki,

    If a mediator has a view injected like this:
    [Inject] public var someView : SomeView;

    and you want to listen to an event dispatched by one of its subcomponents (someSubcomponent), you can do this:
    eventMap.mapListener(view.someSubcomponent, MouseEvent3D.MOUSE_OVER, onMeshMouseOver);

    But, there is a better way to handle such situations. Inside your View, you add a handler for an event like MouseEvent3D.MOUSE_OVER. Within that handler you dispatch a custom event. The mediator adds a listener for that custom event:
    addViewListener(SomeEvent.SOMETHING_HAPPEND, onSomethingHappened, SomeEvent);

    I explained why it is better to use custom events in this post:

    For robotlegs 2 + awayy3D there is another extension:

    Does this help?


  2. 2 Posted by poq2011 on 18 Feb, 2013 06:03 PM

    poq2011's Avatar

    Thanks for quick reply. The second way to do it sounds logical, it should help!

  3. Support Staff 3 Posted by Ondina D.F. on 19 Feb, 2013 11:26 AM

    Ondina D.F.'s Avatar

    You're welcome!

  4. Ondina D.F. closed this discussion on 19 Feb, 2013 11:26 AM.

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