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