Mediate Starling- AND DisplayList-Sprites on the same context?

Gustavo's Avatar

Gustavo

25 Aug, 2014 02:45 PM

Hi guys, I was just wondering how do you mediate both Starling Sprites and Robotlegs Sprites when you need both on the same App.

Until now all my projects have been either Starling or Flash.displayList

But today I tried to ad a displayList Sprite to a project on Starling and the mediator was never created after mapping it, is there anything special that I need to do to be able to mediate both types?

Thanks

  1. Support Staff 1 Posted by Ondina D.F. on 26 Aug, 2014 11:59 AM

    Ondina D.F.'s Avatar

    Hi Gustavo,

    Hmm, Starling's DisplayObjectContainer and Starling's EventDispatcher are a pain in the ...code;) Besides, I'm not a Starling expert. Anyway, I'll try to help you. Hopefully, others will chime in as well.

    Which Starling extension are you using?

    If you're using jamieowen's extension, I think that all you have to do is to let the Mediator for your non-Starling display object extend a regular robotlegs Mediator(robotlegs.bender.bundles.mvcs.Mediator), while the mediator for your Starling component will extend a StarlingMediator.

    If you're using the SARS extension, you'll probably have to mediate your non-starling components manually. You create a mapping:

    mediatorMap.map(NonStarlingView).toMediator(NonStarlingMediator);
    

    Then, somewhere you create your view:

    var nonStarlingView: NonStarlingView = new NonStarlingView();
    
    addChild(nonStarlingView);
    
    mediatorMap.mediate(nonStarlingView);
    

    Of course, that's a bit uncomfortable, because you have to have access to the mediatorMap in order to make it work. Maybe you can let the mediator of the view that is adding the nonStarlingView access an injected mediatorMap, even if it's not a very nice solution.

    Or, if you use the ViewProcessorMap to map your nonStarlingView, you can do:
    viewProcessorMap.process(nonStarlingView);

    If you need more help with this, try to explain your use case in more detail, and also don't forget to mention which libraries you're using.

    Ondina

  2. 2 Posted by Gustavo on 26 Aug, 2014 12:34 PM

    Gustavo's Avatar

    Hi Ondina,

    Thanks for your answer.

    I'm using SARS, or better said, a forked modified version of SARS... Anyways... calling the mediation manually did the trick!

    I'm wondering if you are using another library other than SARS for Away3D + Starling projects.

    Thanks again

    Gustavo

  3. Gustavo closed this discussion on 26 Aug, 2014 12:49 PM.

  4. Ondina D.F. re-opened this discussion on 26 Aug, 2014 01:36 PM

  5. Support Staff 3 Posted by Ondina D.F. on 26 Aug, 2014 01:36 PM

    Ondina D.F.'s Avatar

    I'm glad that manual mediation worked for you!

    I haven't been using Starling in my projects until now. That might change in the future, though. I think SARS and jamieowen's are the most popular Starling extensions.

    Look for 'Starling' under:
    http://knowledge.robotlegs.org/discussions/examples/20-links-to-rob...

    There are also a few examples.

  6. Ondina D.F. closed this discussion on 26 Aug, 2014 01:36 PM.

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