Spark GraphicElements not Mapping to Mediators

Garth Braithwaite's Avatar

Garth Braithwaite

05 May, 2010 08:38 PM

Messing with Spark GraphicElements but they aren't mapping to mediators.

I included a simple example project with trace statements illustrating the problem.

I might be doing something dumb, but it looks right to me.

  1. 1 Posted by Garth Braithwai... on 05 May, 2010 08:46 PM

    Garth Braithwaite's Avatar

    Sorry, I forgot to include the injected ellipse in the mediator class, but the problem remains, I included the updated project.

  2. Support Staff 2 Posted by Shaun Smith on 05 May, 2010 08:47 PM

    Shaun Smith's Avatar

    My first thought:

    http://github.com/robotlegs/robotlegs-framework/blob/v1.0.3/src/org...

    perhaps Spark GraphicElements don't dispatch creationComplete events?

  3. Support Staff 3 Posted by Shaun Smith on 05 May, 2010 09:04 PM

    Shaun Smith's Avatar

    Ah, an Ellipse is not a view component:

    Ellipse <- FilledElement <- StrokedElement <- GraphicElement <- EventDispatcher!

    So, unfortunately, that's not going to work with auto-mediation (which is display list driven) - you'd have to mediate manually. Boo.

  4. 4 Posted by Garth Braithwai... on 05 May, 2010 09:27 PM

    Garth Braithwaite's Avatar

    Poop. It's what I was afraid of.

    Any best practices for mediating manually?

  5. Support Staff 5 Posted by Joel Hooks on 05 May, 2010 09:36 PM

    Joel Hooks's Avatar

    I mediate manually from a mediator of the parent container. This can be the root app in some circumstances.

  6. Support Staff 6 Posted by Shaun Smith on 05 May, 2010 09:45 PM

    Shaun Smith's Avatar

    Wait a potato.. why would you be mediating an Ellipse?

    Regarding manual mediation:

    1. It's a good idea to disable autoCreate and autoRemove (last two params) when mapping mediators that you plan on manually mediating.
    2. Always remember to remove mediators when you are done.
    3. http://knowledge.robotlegs.org/discussions/questions/117-any-other-...
  7. 7 Posted by Garth Braithwai... on 05 May, 2010 10:10 PM

    Garth Braithwaite's Avatar

    I have my reasons.

    So if I manually map mediators, is there a central class that stores references to these mediators?

  8. Support Staff 8 Posted by Shaun Smith on 05 May, 2010 10:20 PM

    Shaun Smith's Avatar

    Fair enough.

    Indeed, mediator instances are held in the MediatorMap.

  9. Support Staff 9 Posted by Shaun Smith on 05 May, 2010 10:26 PM

    Shaun Smith's Avatar

    Side note: bootstrapping the context in MXML can be done like this:

    <fx:Declarations>
        <controller:AppContext contextView="{this}"/>
    </fx:Declarations>
    

    which removes the need for a messy lookin' script block.

  10. 10 Posted by Garth Braithwai... on 05 May, 2010 11:04 PM

    Garth Braithwaite's Avatar

    True, but I'm on an anti-binding kick. Makes me feel like I care about performance.

  11. Support Staff 11 Posted by Shaun Smith on 05 May, 2010 11:09 PM

    Shaun Smith's Avatar

    Yeh, I hear you, I'm on that same trip - ripping out binding makes me happy.

  12. 12 Posted by Garth Braithwai... on 06 May, 2010 07:09 PM

    Garth Braithwaite's Avatar

    Do you think there will ever be any plans to add support for auto mediation mapping of Graphic Elements?

    I'll be looking at forking and trying to implement it, but would it ever be merged in the trunk if I do get it working?

  13. Support Staff 13 Posted by Shaun Smith on 06 May, 2010 07:27 PM

    Shaun Smith's Avatar

    If you can figure out how to do it, then sure, it would almost certainly be merged in. To be honest though, I don't see any way to automatically do something with an entity that doesn't land on stage and doesn't dispatch any useful events. I'd be very happy to be proved wrong though.

  14. 14 Posted by Daniel on 08 May, 2010 08:34 AM

    Daniel's Avatar

    2 cents:
    1 cent: wrap your ellipse in a group
    2 cents: dispatch creation complete event and other events RL is interested in all bys yourself

  15. Stray closed this discussion on 10 Feb, 2011 05:17 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