Away3D and Robotlegs : How to have a MouseEvent3D Fired??
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?
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
| ? | 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
Support Staff 1 Posted by Ondina D.F. on 17 Feb, 2013 11:05 AM
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:
http://knowledge.robotlegs.org/discussions/problems/644-events-bein...
For robotlegs 2 + awayy3D there is another extension:
https://github.com/Vj3k0/robotlegs-bender-example-SARS-integration
Does this help?
Ondina
2 Posted by poq2011 on 18 Feb, 2013 06:03 PM
Thanks for quick reply. The second way to do it sounds logical, it should help!
Support Staff 3 Posted by Ondina D.F. on 19 Feb, 2013 11:26 AM
You're welcome!
Ondina D.F. closed this discussion on 19 Feb, 2013 11:26 AM.