Robotlegs 2 - Away3D

Jono's Avatar

Jono

23 Oct, 2015 05:52 AM

Hi,

I'm having issues having the mediator for an Away3D view to create.

I have them mapped:
mediatorMap.map(Away3DView).toMediator(Away3DMediator);

But the mediator is not created even though I see the instance of the Away3DView on the stage.

For RL1 I saw a solution:
mediatorMap.createMediator(viewComponent);

The reason stated being:
"by default Robotlegs automatically creates the Mediator when the View dispatches Event.ADDED_TO_STAGE. Object3Ds don’t dispatch that, so you have to create the Mediator yourself"

Is this still the case with RL2?

Thanks,
Jono

  1. Support Staff 1 Posted by Ondina D.F. on 23 Oct, 2015 11:39 AM

    Ondina D.F.'s Avatar

    Hi Jono,

    Robotlegs 2 works the same way as robotlegs 1 with regards to listening to added to stage events and creation of mediators.
    The new feature in rl2 is the ViewProcessorMapExtension:
    https://github.com/robotlegs/robotlegs-framework/tree/master/src/ro...

    But, the issues encountered with away3d, starling, feather and the like remain: robotlegs can't handle 3DViews, either because, as you said, they don't dispatch added to stage events, or because the 3D stage doesn't have a display list ...

    My suggestion is to use this extension for robotlegs 2, which works with away3d and starling:

    https://github.com/Vj3k0/robotlegs-extensions-SARS

    Here are a few other extensions listed:
    http://knowledge.robotlegs.org/discussions/robotlegs-2/13222-how-to...

    Let me know if using sars solved your issues.

    Ondina

  2. 2 Posted by Jono on 23 Oct, 2015 01:54 PM

    Jono's Avatar

    Hi Ondina,

    Thanks for your reply.

    I looked at https://github.com/jamieowen/robotlegs2-away3d-viewmap also and tried implementing it, but had no luck.

    I am actually using SARS already, a slightly modified version so I could use the latest Starling. I've not yet had to use any Away3D in it, but now when I try I'm not having much success.

    I re-created the SARS demo with these modifications to use the most recent components and put it here:
    https://bitbucket.org/jkafkaris/base-sars-application

    Can you suggest the steps I would follow to add an Away3D element with a Mediator in this example?

    Many thanks,
    Jono

  3. Support Staff 3 Posted by Ondina D.F. on 23 Oct, 2015 03:33 PM

    Ondina D.F.'s Avatar

    No problem, Jono.

    In the robotlegs.bender.example.sarsintegration.config.Config.as there is this:

    mediatorMap.map(IButton).toMediator(ButtonMediator);
    

    Button3D is an away3d.containers.ObjectContainer3D and it implements IButton.

    Thus a ButtonMediator will be created for a Button3D when it is added as a child to a view3D.scene.

    The ButtonMediator has:

    [Inject]
    public var view:IButton;
    

    Does that not work for you?

  4. 4 Posted by Jono on 24 Oct, 2015 11:43 AM

    Jono's Avatar

    Hi Ondina,

    Totally my bad - I dropped the ball on this one! When installing he SARS Bundle I forgot to pass the view3D (as previously I had no Away3D in this specific project) and then was attempting to add the Away3D instance an incorrect way also...

    After passing the "root" view3D and [Inject]ing the correct one all is good.

    Thanks for enlightening me : )

    Jono.

  5. Jono closed this discussion on 24 Oct, 2015 11:43 AM.

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