Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Highlighted
New Contributor
Posts: 4
Registered: ‎01-07-2011
My Device: playbook (simulator so far)
Accepted Solution

AS3 facebook SDK: login + logout + login = Error #2004: StageWebView/dispose()

We're trying get a basic actionscript example working that will allow a user to login to facebook or change users from within an app.

I have it working thus far:
1) initialize the app and
  a) recognize if a session is active - display username and logout button or
  b) recognize if no session active - display login button
2) login works the first time, app recognizes session and displays username and logout button
3) logout button always works (so far) - takes you back to login screen

but...

4) the second time you login (i.e., you logged in, logged out, and logged in again, or even logout1-login1-logout2-login2 if a session was already active) it gives me this error before the login window appears:

ArgumentError: Error #2004: One of the parameters is invalid.
    at flash.media:Smiley FrustratedtageWebView/dispose()
    at com.facebook.graph::FacebookMobile/createWebView()[C:\...\mobileAPI\com\facebook\graph\FacebookMobile.as:492]
    at com.facebook.graph::FacebookMobile/login()[C:\...\mobileAPI\com\facebook\graph\FacebookMobile.as:375]
    at com.facebook.graph::FacebookMobile$/login()[C:\...\mobileAPI\com\facebook\graph\FacebookMobile.as:126]
    at MobileFacebookLogin/loginClick()[C:\...\Adobe Flash Builder Burrito Preview\MobileFacebookLogin\src\MobileFacebookLogin.as:211]



The call to login() is identical both times:
FacebookMobile.login(loginHandler, stage, [])

This is the logout call:
FacebookMobile.logout(logoutHandler)


Let me know if you need any more information

thanks,
Gavin and Frank

 

P.S. we're using:

Windows 7 Home Premium 64-bit version 6.1 (Build 7600)
Adobe® Flash® Builder™ (code named Burrito) Preview Version
GraphAPI_Mobile_1_5.swc
blackberry-tablet-sdk-0.9.1
using the blackberry playbook simulation provided in Burrito

 

Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: AS3 facebook SDK: login + logout + login = Error #2004: StageWebView/dispose()

hey gavin (and frank),

 

im assuming that on line 492 thats where the login() method is invoked? have you tried doing a trace on each of the parameters before the method is called? just to see what they are at that second. sometimes a problem i run into is i dont realize that a method gets called more than the amount of times that i intend on it being called. either because of a listener, a loop, anything. so i would definitely look out for it being called more times than u think. a simple trace should tell you if thats the case. let me know what you find. good luck!

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
New Contributor
Posts: 4
Registered: ‎01-07-2011
My Device: playbook (simulator so far)

Re: AS3 facebook SDK: login + logout + login = Error #2004: StageWebView/dispose()

line 492 is in the facebook api source. my code calls FacebookMobile.login at line 211 of MobileFacebookLogin.as thing is, the parameters are all hard-coded literals. Except maybe "stage", which I haven't fully wrapped my head around yet. I'll check for any possibility of multiple calls when I'm back at my desk. I believe I'm using the same LabelButton with the same eventListener each time, and just popping it's Container in and out of the main sprite. Do eventlisteners need to be reset in some way after use? Or could multiple eventlisteners on one button cause trouble (I don't think that this is the case in my code).
Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: AS3 facebook SDK: login + logout + login = Error #2004: StageWebView/dispose()

if you only have one button that has one event listener that calls runs one function after it responds to a mouse click then you shouldnt be having any issues with the function running twice. the stage that you are sending is your "root class". basically you are giving control of your entire stage by sending it into that function. its not really a security risk or anything, the facebook API probably needs full control of your sprites, objects, etc. im not sure what you meant by multiple listeners on the same labelbutton object. could you elaborate?

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
New Contributor
Posts: 4
Registered: ‎01-07-2011
My Device: playbook (simulator so far)

Re: AS3 facebook SDK: login + logout + login = Error #2004: StageWebView/dispose()

I don't think this is happening, but what would happen if you tried to addEventListener again on the same LabelButton?
Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: AS3 facebook SDK: login + logout + login = Error #2004: StageWebView/dispose()

if you add the same event listener event with the same function, it shouldnt be a problem. but if you are adding multiple event listeners that listen for different events or fire different functions on the same object, then you might run into problems.

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
New Contributor
Posts: 4
Registered: ‎01-07-2011
My Device: playbook (simulator so far)

Re: AS3 facebook SDK: login + logout + login = Error #2004: StageWebView/dispose()

Solved it! (well, my dev partner did)

 

So it turns out that in between logging out and logging back in it is neccessary to set this.webView = null.

 

This is definitely an undocumented interaction (read bug).

Developer
Posts: 439
Registered: ‎10-25-2010
My Device: Not Specified

Re: AS3 facebook SDK: login + logout + login = Error #2004: StageWebView/dispose()

[ Edited ]

This is an error in the SDK and we're going to post a fix soon.

 

If you're linking from the source code, just comment out the line with "webView.dispose()" and you're fine.

 

shawn@gskinner.com

Developer
Posts: 144
Registered: ‎12-18-2010
My Device: Limited Edition Z10 & Blackberry Playbook
My Carrier: Rogers Wireless

Re: AS3 facebook SDK: login + logout + login = Error #2004: StageWebView/dispose()

@gavinenns - After logging in does your app screen turn completely white with the word "Success" in the top corner in a small font that remains until you tap the screen? I just started adding facebook integration to my app and the is what I'm experiencing. Just wondering if this normal behaviour and if there is a way to not display this screen?

Thanks,

Zymatic
Playbook Apps:
Touch Painter, LinkShrink

BB10 Apps:
NoteToSelf , LinkShrink