Mediator Cannot Access View

digitaldavenyc's Avatar

digitaldavenyc

31 Aug, 2010 04:24 PM

I'm working on a new RobotLegs app and I'm trying to access anything inside my view from the mediator, unfortunately I cannot access anything. I cannot access any public variable or function. My guess is that I have something wrong on a high level but I don't know for sure.

` public class ContentMediator extends Mediator
{

[Inject]
public var view:ContentView;

override public function onRegister():void
{
    view.setData("test");
    addViewListener(Event.ADDED_TO_STAGE, onInit);
}

private function onInit(event:Event):void
{
    trace("addedtostage");
}

} `

  1. 1 Posted by Paul Robertson on 31 Aug, 2010 05:15 PM

    Paul Robertson's Avatar

    Is your view class really a "ContentView" instance?

    What are you seeing, that tells you it's not working?

    For example, do you get a compiler error? No code hints? Or does it
    compile but you get runtime errors? Or does the onRegister() method just
    never get called?

    Is this the "main" view of the app, or a child view?

    Did you set up a mediator mapping in the context?
    mediatorMap.mapView(ContentView, ContentMediator);

    Paul

  2. 2 Posted by digitaldavenyc on 31 Aug, 2010 05:21 PM

    digitaldavenyc's Avatar

    I figured out what the problem was, it was my package name conflicting with the public var view. always something so simple. i setup proper package names and everything is working.

  3. Shaun Smith closed this discussion on 01 Sep, 2010 12:36 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