Model is null when I try and use it later in the service

Nikos 's Avatar


04 Oct, 2010 04:28 PM

Hi all,

For some reason my userModel is null when I try and use it later in the service

public class AuthenticationService extends Actor implements IAuthenticationService
    private var userModel:UserModel;

    private function resultHandler(event:ResultEvent):void
        if (event.result.length == 1){

            var test:Object = event.result[0];

            var user:User = new User;
   = event.result[0].mail;
   = event.result[0].name;
            user.SAMAccountName = event.result[0].SAMAccountName;
            user.commentsUsersSelect = event.result[0].commentsUsersSelect;
            user.commentsView = event.result[0].commentsView;
            user.ratingsView = event.result[0].ratingsView;
            //just update the model here instead of calling a command
            userModel.loggedInUser = user;

            dispatch(new UserEvent(UserEvent.USER_LOGIN,user));


configured here:
public class ConfigureModelCommand extends Command

    override public function execute():void
    dispatch(new ApplicationConfigurationEvent(ApplicationConfigurationEvent.CONFIGURE_VIEW));
  1. 1 Posted by Stray on 04 Oct, 2010 05:14 PM

    Stray's Avatar

    Hi Nikos,

    Injected values have to be public - yours is private :)

    An easy mistake to make, and an easy fix too!


  2. Support Staff 2 Posted by Ondina D.F. on 04 Oct, 2010 05:27 PM

    Ondina D.F.'s Avatar

    After doing what Stray said, you'll have to fix the [Inject] tag too :)






    public var someClass:SomeClass;


  3. 3 Posted by Stray on 04 Oct, 2010 05:33 PM

    Stray's Avatar

    Well spotted! I was so distracted by the private I didn't even check the spelling of [Inject].

  4. 4 Posted by Nikos on 05 Oct, 2010 08:25 AM

    Nikos 's Avatar

    haha woops, btw why is it that vars need to be public?

  5. 5 Posted by Stray on 05 Oct, 2010 08:31 AM

    Stray's Avatar

    Just because if they were private the injector wouldn't be able to access them. The actual method of setting values is subject to the same rules as usual.

    The alternative is setter injection - private var, and a public setter func, marked with inject.

  6. Shaun Smith closed this discussion on 01 Nov, 2010 10:51 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? 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