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 7905285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:25:00+00:00 2026-06-03T10:25:00+00:00

I have downloaded the Facebook API example and have a test run on. FacebookMobile.login(handleLogin,

  • 0

I have downloaded the Facebook API example and have a test run on.

FacebookMobile.login(handleLogin, stage, extendedPermissions, new StageWebView());

However this code seems to be not working, it doesn’t open new Facebook log in page.

Here is the full source code, and i am running under Adobe Air 3.0

package  {

    import flash.display.MovieClip;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.display.Stage;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.media.StageWebView;

    import com.facebook.graph.FacebookMobile;
    import com.facebook.graph.controls.Distractor;

    import demo.controls.GraphicButton;
    import demo.events.FacebookDemoEvent;
    import demo.models.FriendModel;
    import demo.views.FriendDetail;
    import demo.views.FriendsList;
    import demo.views.UserInfo;

    public class FriendListMobile extends MovieClip {

        //Place your application id here.
        protected static const APP_ID:String = 'xxxxxxxx';
        //Place your specified site URL for your app here. This is needed for clearing cookies when logging out.
        protected static const SITE_URL:String = 'xxxxxxxx';
        //Extended permission to access other parts of the user's profile that may be private, or if your application needs to publish content to Facebook on a user's behalf.
        protected var extendedPermissions:Array = ["publish_stream","user_website","user_status","user_about_me"];

        public var userInfo:UserInfo;
        public var loginBtn:GraphicButton;
        public var friendDetail:FriendDetail;
        public var friendList:FriendsList;

        public var distractor:Distractor;
        public var bg:DistractorOverlay;
        public var friendsModel:FriendModel;

        protected var selectedUserInfo:Object = {};

        public function FriendListMobile() {
            // constructor code
            addEventListener(Event.ADDED_TO_STAGE, handleAddedToStage);
        }

        protected function handleAddedToStage(event:Event):void {
            removeEventListener(Event.ADDED_TO_STAGE, handleAddedToStage);
            stage.align = StageAlign.TOP_LEFT;
            stage.scaleMode = StageScaleMode.NO_SCALE;
            init();
        }

        protected function init():void {
            configUI();
            addEventListeners();

            FacebookMobile.init(APP_ID, onHandleInit, null);
        }

        protected function configUI():void {
            loginBtn.label = 'Login';
            loginBtn.setSize(440, 60);
            loginBtn.setStyle('font', '_sans');
            loginBtn.setStyle('size', 25);

            friendsModel = new FriendModel();

            distractor = new Distractor();
            friendDetail.visible = false;

            bg = new DistractorOverlay();
            bg.visible = true;
            addChild(bg);

            distractor.x = 120
            distractor.y = 310; 

            bg.addChild(distractor);
        }

        protected function addEventListeners():void {
            loginBtn.addEventListener(MouseEvent.MOUSE_DOWN, handleLoginClick, false, 0, true);
            friendDetail.addEventListener(Event.CLOSE, onCloseDialog, false, 0, true);
            friendsModel.addEventListener(Event.COMPLETE, onFriendsComplete, false, 0, true);
            friendList.addEventListener(FacebookDemoEvent.FRIEND_SELECTED, onFriendSelected, false, 0, true);
        }

        /**
         * Pops up detail view for a selected friend.
         **/
        protected function showFriendDetail():void {
            bg.visible = true;

            friendDetail.visible = true;
            friendDetail.data = selectedUserInfo;

            this.setChildIndex(friendDetail, this.numChildren - 1);
        }

        /**
         * Event Handler Close DetailView
         **/
        protected function onCloseDialog(event:Event):void {
            friendDetail.visible = false;
            bg.visible = false;
        }

        /**
         * Event Handler user selects from the friend list.
         **/
        protected function onFriendSelected(event:FacebookDemoEvent):void {
            selectedUserInfo = event.data;
            showFriendDetail();
        }

        /**
         * Event Handler User clicks Login button.
         **/
        protected function handleLoginClick(event:MouseEvent):void {
            bg.visible = true;

            loginUser();
        }

        /**
         * Event Handler User clicks on Logout button.
         **/
        protected function handleLogOutClick(event:MouseEvent):void {
            FacebookMobile.logout(handleLogout, SITE_URL);

            loginBtn.label = 'Login';
            loginBtn.addEventListener(MouseEvent.MOUSE_DOWN, handleLoginClick, false, 0, true);

            friendList.clear();
            userInfo.clear();

            bg.visible = true;
        }

        /**
         * Event Handler once logged out.
         **/
        protected function handleLogout(response:Object):void {
            bg.visible = false;
        }

        /**
         * Event Handler FacebookMobile initializes application.
         * Application will check if user is return to application, 
         * if not user is prompted to log in.
         **/
        protected function onHandleInit(response:Object, fail:Object):void {
            if (response) {
                updateView(response.uid, response);
            } else {
                loginUser();
            }
        }

        /**
         * Updates UI for views 
         **/
        protected function updateView(id:String, data):void {
            userInfo.id = id;
            userInfo.data = data;

            loginBtn.label = 'Log Out';
            loginBtn.addEventListener(MouseEvent.MOUSE_DOWN, handleLogOutClick);
            loginBtn.removeEventListener(MouseEvent.MOUSE_DOWN, handleLoginClick);

            friendsModel.load();
        }

        /**
         * Preforms a login call to application. Mobile application takes in an instance 
         * StageView class.
         **/
        protected function loginUser():void {
            trace('not log in');
            FacebookMobile.login(handleLogin, stage, extendedPermissions, new StageWebView());
        }

        /**
         * Event Handler once user logs in.
         **/
        protected function handleLogin(response:Object, fail:Object):void {
            bg.visible = false;
            FacebookMobile.api('/me', handleUserInfo);
        }

        /**
         * Event Handler for users information.
         **/
        protected function handleUserInfo(response:Object, fail:Object):void {
            if (response) {
                updateView(response.id, response);
            }
        }

        /**
         * Event Handler FriendModel information has been loaded.
         **/
        protected function onFriendsComplete(event:Event):void {
            bg.visible = false;
            friendList.dataProvider = friendsModel.dataProvider;
        }
    }

}

Is this because it only works under mobile devices, and you can’t test on the desktop?

  • 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-06-03T10:25:03+00:00Added an answer on June 3, 2026 at 10:25 am

    When developing a Flex Mobile application that logged in to Facebook, what worked for me was to set the following parameters to the StageWebView before passing it into the login function:

    For Flex:

    StageWebView webView = new StageWebView();
    webView.stage = FlexGlobals.topLevelApplication.stage;
    webView.viewPort = new Rectangle(0, 0, FlexGlobals.topLevelApplication.stage.stageWidth, FlexGlobals.topLevelApplication.stage.stageHeight);
    

    I haven’t tested this code on a non-Flex air app for mobile, but you can try this:

    StageWebView webView = new StageWebView();
    webView.stage = stage;
    webView.viewPort = new Rectangle(0, 0, stage.stageWidth, stage.stageHeight);
    

    and passing it into the login function:

    FacebookMobile.login(handleLogin, stage, extendedPermissions, webView);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have really simple few lines of Facebook app, using the new Facebook API:
I have downloaded facebook-java-api-3.0.2-bin from http://code.google.com/p/facebook-java-api/ for connecting to face book.I want to use
I have downloaded php-sdk for using facebook in php. I also created facebook application
I have downloaded both samples for the Facebook Developer Kit from Codeplex and Facebook.NET
I want to integrate Facebook with my Blackberry app. For that I have downloaded
I have downloaded Prabir's application ASP.NET MVC Canvas App using Facebook C# SDK showing
i want connect my android application to facebook , I have downloaded easy facebook
I am trying to migrate to the new Facebook API for websites, and just
I have recently downloaded the Facebook PHP SDK to try and post to a
I'm trying to clone the facebook iOS API located on github.com. I'm new to

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.