Forum ActionScript 3.0 Yahoo Relations does not work

Problems and discussions relating to ActionScript 3.0 here.

Yahoo Relations does not work

Postby levi.amit » July 10th, 2014, 10:50 am

Hi all,

I am trying to use Yahoo Relations for getting the users friends.

On my application start up i am calling PlayerIO.authenticate and in its callback i am setting the yahoo variable and refresh it.
On my refresh callback function i am trying to get the friends but i get an error for not refreshing the yahoo variable.

This is my code:

PlayerIO.authenticate(Bingo.stage, "wingo-bingo-dzjmy9dfghclelrqdrd4hw", "public", { userToken: yahooVars['userToken'] }, null, onYahooAuthenticate, onError);

private function onYahooAuthenticate(client:Client):void
{
trace("yahoo authenticate " + client);
yahoo = new Yahoo(client);
client.yahoo.refresh(onYahooRefresh, onError);
}

private function onYahooRefresh():void
{
trace("yahoo refresh");
var friends:Array = yahoo.relations.friends;
for (var i:int = 0; i < friends.length; i++)
yahoo.profiles.showProfile(friends[i], onSuccess);
}

private function onSuccess(e:Object):void
{
trace("onSuccess, " + e);
}

private function onError(e:Object):void
{
trace("onError, " + e);
}

This is the error log i get:

[ErrorReport message=Cannot access friends before Yahoo has loaded. Please call client.Yahoo.Refresh() first. name=PlayerIOError.Error id=201
stackTrace=Error: Cannot access friends before Yahoo has loaded. Please call client.Yahoo.Refresh() first.
at YahooRelations/get friends()[C:\PlayerIO\Client Libraries\ActionScript 3\PlayerIOClient\src\playerio\YahooRelations.as:51]
at com.bingoz.client.bingo.controllers::StartUpController/onYahooRefresh()[C:\dev\bingoClientNew\src\com\bingoz\client\bingo\controllers\StartUpController.as:149]
at Function/Yahoo.as$0:anonymous()[C:\PlayerIO\Client Libraries\ActionScript 3\PlayerIOClient\src\playerio\Yahoo.as:62]
at Function/Social.as$0:anonymous()[C:\PlayerIO\Client Libraries\ActionScript 3\PlayerIOClient\src\playerio\Social.as:20]
at Function/Social.as$0:anonymous()[C:\PlayerIO\Client Libraries\ActionScript 3\PlayerIOClient\src\playerio\generated\Social.as:23]
at Function/HTTPChannel.as$0:anonymous()[C:\PlayerIO\Client Libraries\ActionScript 3\PlayerIOClient\src\playerio\utils\HTTPChannel.as:53]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
data=]

Please advise

Amit Levi
Last edited by levi.amit on July 16th, 2014, 1:53 pm, edited 1 time in total.
levi.amit
 
Posts: 4
Joined: June 16th, 2014, 8:28 am

Re: Yahoo Relations does not work

Postby levi.amit » July 13th, 2014, 8:39 am

I found the problem:

In the function 'onYahooAuthenticate' the refresh function should be for the yahoo object and not as written.

The function should look like this:

private function onYahooAuthenticate(client:Client):void
{
trace("yahoo authenticate " + client);
yahoo = new Yahoo(client);
yahoo.refresh(onYahooRefresh, onError);
}

But now when i get the friend list it is empty.

Does anybody know how do i become a friend in yahoo?
Is it an application friend? A yahoo messenger friend?

Please advise

Amit
levi.amit
 
Posts: 4
Joined: June 16th, 2014, 8:28 am

Re: Yahoo Relations does not work

Postby Henrik » July 29th, 2014, 9:54 pm

There is some documentation here for letting users become friends with each other:

https://gamesnet.yahoo.com/documentatio ... al/friends

If a user accepts a gamerequest from another user, they will also automatically become friends.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm


Return to ActionScript 3.0



cron