App-Mediator

Fabian's Avatar

Fabian

18 Dec, 2009 04:00 PM

Hi
i d like to mediate my Application "ApplicationContext.as" (this is my main.as)

What i did:

override public function startup():void {

mediatorMap.mapView(MediateApplicationExample, AppMediator);
mediatorMap.createMediator(contextView);

}

The Problem

onRegister() of the AppMediator is never called

  1. Support Staff 1 Posted by Shaun Smith on 18 Dec, 2009 04:33 PM

    Shaun Smith's Avatar

    Hello,

    The MediatorMap will automatically create a Mediator instance the context view as soon as you map it, provided that the view class that you map to is the superclass of the context view (the view that you passed to the context).

    For example:

    In your main application Sprite (main.as)

    context = new MyContext( this );
    

    And then in the context's startup():

    mediatorMap.mapView( Main, MainMediator );
    

    That would automatically create an instance of MainMediator - because the context view (passed to the context) is an instance of Main.

    I think perhaps you have mapped things a little differently, but it is hard to tell without more details (or some code samples).

    Does that help?

  2. 2 Posted by Fabian on 18 Dec, 2009 08:50 PM

    Fabian's Avatar

    I think i missed something

    Main.as

    public function Main() {
      context = new MyContext(this);
    }
    

    MyContext.as

    override public function startup() : void {
      mediatorMap.mapView(Main, ApplicationMediator);
      mediatorMap.createMediator(contextView);
    }
    

    *The Problem:** The stage is empty - white screen! (But the mediator is called).

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