Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6837557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:29:29+00:00 2026-05-26T23:29:29+00:00

This is a fairly general problem I am having here, so I figured I

  • 0

This is a fairly general problem I am having here, so I figured I would ask, hopefully someone can help me out.

I have a flex app using the facebook js bridge to log in, and I am trying to pass the users name back to the app, but I am coming across the thing that I will explain after the code:

function getFriends() {
            var nameOfPlayer = "";
            FB.api('/me', function(response) {
                nameOfPlayer = response.name;
                });
            return nameOfPlayer;
        }

If I have my flex app print nameOfPlayer, it returns undefined, same as if I do an alert with nameOfPlayer, but if I do an alert inside of the FB.api call for nameOfPlayer, then it will pop up with my name, but it still won’t return name. I tried having it return a general string, and that works, so it is passing the information over, it just isn’t saving to the variable. Any idea how to fix this? This is probably very convoluted, so if I need to clarify anything let me know. Thanks in advance for any help you can give me 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:29:30+00:00Added an answer on May 26, 2026 at 11:29 pm

    You should be doing this in an event-driven way. Some pseudo-code is written below to get you started.

    var yourFacebookAPIClass = new yourFacebookAPIClass();
    yourFacebookAPIClass.addEventListener(Event.UserCallComplete, function(ev){
        var nameOfPlayer = SomeParser.ParseData(ev);
        someFunctionThatUsesYourVar(nameOfPlayer);
    });
    yourFacebookAPIClass.getNameOfPlayer();
    

    In your facebook api class:

    function getNameOfPlayer(){
        makeTheApiCallHere();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a pretty simple general programming problem, yet I can't quite get the
I have this general problem in design, refactoring or triage: I have an existing
I am having a fairly huge problem. I am hoping this is due to
I'm sure this is fairly simple, however I have a major mental block on
This is a fairly common problem, it probably has a name, I just don't
I asked a fairly poor question yesterday, but I still have the same general
Basically I attempt to have a link slide down a div. This is fairly
I have a fairly complex WordPress + bbPress installation and I would like to
I have a fairly basic dialog maker for jquery that works in 2 out
Although this is a fairly common problem, I am struggling with what the best

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.