Mediating spark/MXML Application

andreas's Avatar

andreas

13 Feb, 2013 10:54 PM

Hi,

I want to mediate my Spark Application (Main.mxml) but the initialize of my Mediator will never executed.
In my Config I call

mediatorMap.map( Main ).toMediator(MainMediator);
. Here is how my MainMediator looks like:
package mediator.spark {
    import robotlegs.bender.bundles.mvcs.Mediator;
    public class MainMediator extends Mediator {
        [Inject]
        public var view:Main;
        public override function initialize():void {
            trace("init!"); //I never see this
        }
    }
}
  1. Support Staff 1 Posted by Ondina D.F. on 14 Feb, 2013 09:36 AM

    Ondina D.F.'s Avatar

    Hi Andreas,

    I assumed that you were talking about your starling example on github; I dl-ed it and created a MainMediator for the Main view.

    For the Main view to be mediated automatically, you need to start the configuration on preinitialize (your preInit() method). But in this case, you don’t have a reference to the stage yet, so you can’t create your Starling.

    If you run the configuration after addedToStage, you have to manually mediate your Main view:

    mediatorMap.map(Main).toMediator(MainMediator);
    mediatorMap.mediate(rootDisplayObject);

    Does this answer your question?

    Ondina

  2. 2 Posted by andreas on 14 Feb, 2013 03:35 PM

    andreas's Avatar

    yes, it does! Thank you very much, Ondina!

  3. andreas closed this discussion on 14 Feb, 2013 03:35 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