Rudi Mk
Rudi Mk

Reputation: 152

user_work_history with Flex and the ActionScript SDK

I'm working on a sample app for Facebook, using Flash Builder and Flex. Now, I've got everything up and running - but there's one problem, specifically with the work history part. When I try to display the user's work history..here's the code for logging in:

protected function login():void
    {
        FacebookDesktop.login(loginHandler, ["user_birthday", "user_work_history"]);

    }

Here, loginHandler's a callback function, that then goes ahead and displays data about the user:

protected function loginHandler(success:Object,fail:Object):void 
    { 

        if (success){
            currentState = "LoggedIn";
            fname.text = success.user.name;
            userImg.source=FacebookDesktop.getImageUrl(success.uid,"small");
            birthdayLbl.text=success.user.birthday;
            workLbl.text=success.user.work;

        }

    }

Now, the problem occurs with success.user.work - it ends up printing the following:

[object,Object],[object,Object],[object,Object],[object,Object]

Obviously, I'm doing something wrong..but I can't figure out what exactly it is. Would be grateful for some pointers!

Thanks!

Rudi.

Upvotes: 1

Views: 186

Answers (1)

bug-a-lot
bug-a-lot

Reputation: 2454

The object contained in success.user.work is most likely an array of objects, each item representing a work period, so you'll have to treat it as such. Either use a list and a custom renderer for each item, or create a string by iterating over the array, and appending the fields that you're interested in.

To see what the individual objects contain, either use a breakpoint during debug and inspect them, or check to see if they're documented in the facebook development documentation.

Upvotes: 0

Related Questions