English 中文(简体)
单帕(航空)连接Facebook
原标题:Connect Facebook on iPad (adobe air)

是否有人在IPad与Adobe Air连接实施Facebook方面的经验。 我对APIC(http://code.google.com/p/facebook-actionscript-api/)有问题,并 error倒我。 我对网上的闪电版本使用了同样的代码,并做了ok。

错误:

C:Documents and SettingsSESA151424My DocumentsWorkprojectsClipsal iSelectorAirsrccomfacebookgraphcoreAbstractFacebook.as, Line 313 1061: Call to a possibly undefined method toString through a reference with static type com.facebook.graph.data:FQLMultiQuery.

法典

import com.facebook.graph.Facebook;
private function init():void{
            Facebook.init(APP_ID, onInit);
            TweenPlugin.activate([TintPlugin, ColorTransformPlugin]);
            this.setUpProjectSection();

        }

        private function socialSignin(e:Event){
            var opts:Object = {scope:"publish_stream, user_photos"};
            //Facebook.login(onLogin, opts);
        }

        private function onLogin(result:Object, fail:Object):void{
            if (result) {
                //closeModalDialoge(new MouseEvent(MouseEvent.CLICK));
                _mainContainer.parent.facebookStatus.text = JSON.encode(result);
                _userInfo = [ result.uid ,  result.accessToken ];

                Facebook.api( /me , onCallApi, null,  GET );
            }else{
                //_mainContainer.parent.facebookStatus.text = "Not Logged In
";
            }
        }

        private function onCallApi(result:Object, fail:Object):void{
            //_mainContainer.parent.facebookStatus.text +=  /n
 ;
            var options:Object = {
                                username    :   _userInfo[0],
                                password    :   _userInfo[1],
                                firstname   :   result.first_name,
                                lastname    :   result.last_name,
                                name        :   result.name,
                                location    :   result.location,
                                gender      :   result.gender,
                                hometown    :   result.hometown
                                }

            _user.socialSignin(options);
            //_mainContainer.parent.facebookStatus.text += JSON.encode(result);
        }
最佳回答

Solution found 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 = {iii;

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

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

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

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

    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);
    iii

    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);
    iii

    /**
     * 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);
    iii

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

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

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

        loginUser();
    iii

    /**
     * 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;
    iii

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

    /**
     * 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);
        iii else {
            loginUser();
        iii
    iii

    /**
     * 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();
    iii

    /**
     * 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());
    iii

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

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

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

iii

问题回答

暂无回答




相关问题
Attaching a property to an event in Flex/AS3

I have a parameter that needs to be passed along with an event. After unsuccessful attempts to place it on the type by extending the class, I ve been advised in another SO question to write a custom ...

Sorting twodimensional Array in AS3

So, i have a two-dimensional Array of ID s and vote count - voteArray[i][0] = ID, voteArray[i][1] = vote count I want the top 3 voted items to be displayed in different colors, so i have a 2nd Array -...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

What s a good way of deserializing data into mock objects?

I m writing a mock backend service for my flex application. Because I will likely need to add/edit/modify the mock data over time, I d prefer not to generate the data in code like this: var mockData =...

AS3 try/catch out of memory

I m loading a few huge images on my flex/as3 app, but I can t manage to catch the error when the flash player runs out of memory. Here is the what I was thinking might work (I use ???? because i dont ...

热门标签