This repository has been archived by the owner on Sep 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Listening for events
alextel69 edited this page Apr 19, 2014
·
1 revision
After you successfully initialized native extension, you would like to listen for sign-in events.
Attention
- call methods below only after you initialized Games
- do not remove listener inside sign-in process listener. When user opts-out from your game services in Leaderboards or Achievements window, your listener will be notified with
SignIn.FAIL
. Remove listener only when user cannot reach windows mentioned above.
In order to do that, you need to call Games.addStatusEventListener(e:Function)
. Sign-in constants are represented by com.google.api.games.SignIn
Function example:
import flash.events.StatusEvent;
import com.google.api.games.SignIn;
function listener(e:StatusEvent):void
{
switch (e.code)
{
case SignIn.SUCCESS:
// hide sign-in button
break;
case SignIn.FAIL:
// show sign-in button
break;
}
}
As soon as you don't need to listen for sign-in events, call Games.removeStatusEventListener(e:Function)