How do you edit MobileLoginWindow.as?

116 views
Skip to first unread message

Joachim Petersen

unread,
Apr 21, 2013, 1:06:40 AM4/21/13
to facebook-act...@googlegroups.com
Hello

I've seen the solution on previous question: that I need to edit MobileLoginWindow.as
(vars.redirect_uri = FacebookURLDefaults.LOGIN_SUCCESS_URL;    to      vars.redirect_uri = FacebookURLDefaults.LOGIN_SUCCESS_SECUREURL)
How do you edit it, I am new to AS3, download the source library and recompile the library?

Thank you.

Roberto Vidal

unread,
Apr 23, 2013, 5:31:46 PM4/23/13
to facebook-act...@googlegroups.com
As you may already know, you can use the API in two ways: including the compiled SWC library in your project or using the source code version (unzip it and add its contents to your "src" folder). This way you can access the file and edit it.

BTW, the solution works! I´ve just tested it.

Joachim Petersen

unread,
Apr 23, 2013, 7:09:10 PM4/23/13
to facebook-act...@googlegroups.com
Roberto Vidal, thanks for your answer, that was just what I needed, I am now getting error on my logout code, have you had problem with your logout, since the update?

Roberto Vidal

unread,
Apr 23, 2013, 7:59:03 PM4/23/13
to facebook-act...@googlegroups.com
The logout is working well at the moment, no errors.
Are you getting a real error or just a weird behaviour??

I had to apply a patch because the logout url didn´t really logout from the Facebook site, only ends the API session..
So if you try to connect again, it automatically connects using the site session. Even if you want to use another account.

If you are talking about this, take a look at this workaround:

Joachim Petersen

unread,
Apr 24, 2013, 8:06:29 AM4/24/13
to facebook-act...@googlegroups.com
Nope, When I use a different view then the view that i've uswed to login then I get an error like this:

I have been testing and that seems to be what triggers the error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.

                at views::#ProjectNameLoginView/onLogin()[C:\Users\Main\Adobe Flash Builder 4.6\#ProjectName\src\views\#ProjectNameLoginView.mxml:28]

                at com.facebook.graph::FacebookMobile/handleUserLoad()[C:\Users\Main\Adobe Flash Builder 4.6\#ProjectName\src\com\facebook\graph\FacebookMobile.as:489]

                at com.facebook.graph.core::AbstractFacebook/handleRequestLoad()[C:\Users\facebookGraphApi\api\com\facebook\graph\core\AbstractFacebook.as:248]

                at com.facebook.graph.net::AbstractFacebookRequest/dispatchComplete()[C:\Users\facebookGraphApi\api\com\facebook\graph\net\AbstractFacebookRequest.as:290]

                at com.facebook.graph.net::AbstractFacebookRequest/handleURLLoaderIOError()[C:\Users\facebookGraphApi\api\com\facebook\graph\net\AbstractFacebookRequest.as:316]

                at flash.events::EventDispatcher/dispatchEventFunction()

                at flash.events::EventDispatcher/dispatchEvent()

                at flash.net::URLLoader/onComplete()

Code I use(if you call the logout from another view then the error occures):

            protected function init():void
            {
                FacebookMobile.init(fbAppId,onLogin,hest);
            }
           
            public var hest:String = "MY ACCESS TOKEN"
           
            protected function onLogin(success:Object, fail:Object):void{
               
                if(success){
                    state.text = "In"
                   hest = FacebookMobile.getSession().toString()
                }else if(fail)
                {
                    var facebookWebView:StageWebView = new StageWebView();
                    facebookWebView.viewPort = new Rectangle(0,0,stage.width,stage.height);
                    FacebookMobile.login(onLogin, this.stage,["email","read_stream","publish_stream"], facebookWebView);
                }else
                {
                    init();
                }
            }   

Logout code - If you seperate this from the view that you used to login then you get the error:
            private function handleLogout(logObj:Object):void{
                state.text = "Out"
                init();
            }
           
            protected function button1_clickHandler(event:MouseEvent):void
            {
                FacebookMobile.manageSession = false;
                hest=""
                FacebookMobile.logout(handleLogout, "https://m.facebook.com/dialog/permissions.request?---YOUR APP ID HERE&display=touch&next=http%3A%2F%2Fwww.facebook.com%2Fconnect%2Flogin_success.html&type=user_agent&perms=publish_stream&fbconnect=1");


replace the state.text with a navigate.popview and then you will get the error.
            }



Roberto

unread,
Apr 24, 2013, 1:34:05 PM4/24/13
to facebook-act...@googlegroups.com
Joachim, at a first sight I don´t see anything wrong.
You must focus on the error message: line 28 of the file ProjectNameLoginView.mxml.
Go there and see what is going wrong. Probably you are calling a method of a null object.

This is the first step, to know why the object is null. Maybe you are using an object before initializing it. I recommend you to use the debug mode of the Flash Builder (assuming you are using Flash Builder..), setting some breakpoints in the code, so you can launch the application and watch the variable values line by line. If there is something wrong, this is the best way to get the source of the problem.

Good luck!


2013/4/24 Joachim Petersen <joachim...@live.com>

            }



--
You received this message because you are subscribed to the Google Groups "facebook-actionscript-api" group.
To unsubscribe from this group and stop receiving emails from it, send an email to facebook-actionscr...@googlegroups.com.
To post to this group, send email to facebook-act...@googlegroups.com.
Visit this group at http://groups.google.com/group/facebook-actionscript-api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Joachim Petersen

unread,
Apr 24, 2013, 3:33:48 PM4/24/13
to facebook-act...@googlegroups.com
Okay, did that, it seems to be this line in the login view:

facebookWebView.viewPort = new Rectangle(0,0,stage.width,stage.height);

that gives the error, I have no idea why? when it is in the same vi

Joachim Petersen

unread,
Apr 24, 2013, 3:37:40 PM4/24/13
to facebook-act...@googlegroups.com
ew it works fine, you got any idea why it will not let it create a new rectangle object when it reloads the view?

Roberto

unread,
Apr 24, 2013, 3:58:24 PM4/24/13
to facebook-act...@googlegroups.com
If the error is on that line, there are 2 possibilities:

1- facebookWebView is null, so you can´t set "viewPort" or any other property on it.
2- at this point, stage is null, so you can´t access its width/height


2013/4/24 Joachim Petersen <joachim...@live.com>
ew it works fine, you got any idea why it will not let it create a new rectangle object when it reloads the view?
Reply all
Reply to author
Forward
0 new messages