Most menus in the Flash SDK are opened using the toggleInterface function. It has one argument that is a string. The argument tells the SDK what menu to display.

The toggleInterface function is available in the sdk variable. The sdk varaible is available by referencing the Y8 class, if you are using it.

Login Menu

sdk.toggleInterface('login');

Registration Menu

sdk.toggleInterface('registration');

Response Data

After login, registration, and automatic login, an event will be sent to handleSDK. Make an if statement to catch the event and the login data.

function handleSDK(e:Event) {
	//trace(sdk.type);
	//trace(JSON.stringify(sdk.data));
	if (sdk.type == 'login') {
		trace('hello '+sdk.userData.nickname+' your pid is '+sdk.userData.pid);
	}
}

Asynchronous Calls

Take note of how we use handleSDK to get data instead of return data from a function. Because data takes time to travel over the internet, most functions will not return any data directly. The use of handleSDK is repeated throughout the Flash SDK.

Logout

Adding a logout button is discouraged as users can logout at account.y8.com if using a public computer. If you need to logout for testing, please use the secret menu by pressing Ctrl+Alt+Shift.