Forum Sitebox Unable to get fb_access_token from FlashVars

Discussion and help relating to the PlayerIO webpage and Facebook app hosting solution, Sitebox.

Unable to get fb_access_token from FlashVars

Postby playzio » January 29th, 2013, 5:13 pm

Code: Select all
   // this code is copy pasted from the Player.IO seedlings code sample and I have used the same for our facebook game
   private function _ConnectToFacebook() : void {
      var parameters:Object = LoaderInfo(this.root.loaderInfo).parameters;

      //If played on facebook
      if(parameters.fb_access_token){
                      // The code doesn't reach this point. I see that the game in facebook shows me the right variable values                                                                             }
            else {
                  // this works fine                     
      }
   }


I am unable to get this working on facebook. The if condition for the fb_access_token is not evaluating to true. Am I doing anything while while accessing FlashVars.

The above function exists in my Document class.

Actually, I tried passing my own custom flash var by editing index.html and that also doesn't work.
{% extends 'master.html' %}
{% block content %}

{% swf src='swf/abc.swf' width=760 height=500 id='game' myFlashVar = 'testflashvar' %}

{% end %}
playzio
Paid Member
 
Posts: 20
Joined: January 29th, 2013, 12:19 pm

Re: Unable to get fb_access_token from FlashVars

Postby Benjaminsen » January 29th, 2013, 7:15 pm

playzio wrote:
Code: Select all
   // this code is copy pasted from the Player.IO seedlings code sample and I have used the same for our facebook game
   private function _ConnectToFacebook() : void {
      var parameters:Object = LoaderInfo(this.root.loaderInfo).parameters;

      //If played on facebook
      if(parameters.fb_access_token){
                      // The code doesn't reach this point. I see that the game in facebook shows me the right variable values                                                                             }
            else {
                  // this works fine                     
      }
   }




I am unable to get this working on facebook. The if condition for the fb_access_token is not evaluating to true. Am I doing anything while while accessing FlashVars.

The above function exists in my Document class.

Actually, I tried passing my own custom flash var by editing index.html and that also doesn't work.
{% extends 'master.html' %}
{% block content %}

{% swf src='swf/abc.swf' width=760 height=500 id='game' myFlashVar = 'testflashvar' %}

{% end %}


The setup will only work if you use SiteBox for hosting your game. Are you using sitebox?
Likewise, can you link to the application that is failing?
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Unable to get fb_access_token from FlashVars

Postby playzio » January 30th, 2013, 2:42 am

Yes, we are using sitebox for hosting. I can play the game on Facebook. Having problem only with passing,accessing flash vars. Do i need something to enable passing of flash vars.
playzio
Paid Member
 
Posts: 20
Joined: January 29th, 2013, 12:19 pm

Re: Unable to get fb_access_token from FlashVars

Postby playzio » January 30th, 2013, 1:12 pm

I got that working by changing the line
Code: Select all
parameters = LoaderInfo(this.root.loaderInfo).parameters

to
Code: Select all
parameters = stage.loaderInfo.parameters


Any idea why the original line doesn't work.
playzio
Paid Member
 
Posts: 20
Joined: January 29th, 2013, 12:19 pm

Re: Unable to get fb_access_token from FlashVars

Postby Benjaminsen » January 30th, 2013, 2:53 pm

playzio wrote:I got that working by changing the line
Code: Select all
parameters = LoaderInfo(this.root.loaderInfo).parameters

to
Code: Select all
parameters = stage.loaderInfo.parameters


Any idea why the original line doesn't work.


You ran the code inside a context where this did not relate to the main class of your project :). Thus the reference to this.stage was invalid :)
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark


Return to Sitebox



cron