Description
If the application or screen saver is expired, this event will be triggered and will be only triggered for one time just after the main window is appeared on the screen.
The default action of SWFKit is to display an dialog box, with a "register" button (if the application supports unlock) and a "exit" button when the application is expired. If the user click the "exit" button, the application will terminate; if the user click the "register" button, the registration box will be displayed. If the registration is succeeded, the application will continue to run, otherwise it will terminate.
You can change the default action by handling this event. if the donot_call_the_default_handler.value is set to true, the SWFKit won't do the default action. You can display your own message box and registration box later. But you must do something to prevent the users from continuing using the application without registration in this case, or the lock system is passed by the event handler and cannot protect you application.
Syntax
Application.Expiry.onExpired =
function (donot_call_the_default_handler)
{
//donot_call_the_default_handler.value = true;
}
Examples
The example shows how to make your own registration method.
registered = readProfile("main",
"registered") == "OK";
function myRegister(username, sn, pass)
{
if (sn != 'guest' || pass != 'guest')
{
registered = false;
}
else registered = true;
if (registered)
{
writeProfile("main", "registered", "OK");
}
return registered;
}
function myIsRegistered()
{
return registered;
}
Application.Expiry.onExpired =
function (donot_call_the_default_handler)
{
if (Application.Expiry.isExpired &&
!myIsRegistered())
{
trace("Expired, you must register");
//get the user name, pass, and sn
//...
if (!myRegister(username, sn, pass))
{
trace("wrong pass or sn, you won't get full function");
}
}
donot_call_the_default_handler.value = true;
}