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 idnet variable. The idnet varaible is available by referencing the IDI class, if you are using it.

Login Menu

idnet.toggleInterface('login');

Registration Menu

idnet.toggleInterface('registration');

Response Data

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

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

Asynchronous Calls

Take note of how we use handleIDNET 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 handleIDNET is repeated throughout the Flash SDK.

Logout

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