mApplication.deleteSelf()

Availability

Windows: Flash 8 or 9 AS2.0 SWF + mProjector 3.0; Windows 98/ME/NT Support: Flash 7 SWF + mProjector 2.0 build 'dj';

Macintosh: Flash 8 or 9 AS2.0 SWF + mProjector 2.0.3;

Usage

mApplication.deleteSelf(andContainingFolder:Boolean) : Void

Parameters

andContainingFolder - WINDOWS Only. If true and the containing folder is empty, the folder will be deleted.

Returns

Nothing.

Description

Method; Deletes the application file. On Windows the application is flagged for deletion and is removed on the next computer restart. On the Mac the application is moved to the trash.

Example

This sample uninstalls an application.

The code removes the registry entries for the Windows "Add and Remove Program" control panel, removes the Startup shortcut (or startup setting on the Mac), deletes the application and attempts to delete it's containing folder, and quits the application.

function uninstallApplication (productName:String) {
	deleteAddRemoveProgramEntry(productName);   // removes entry in Add/Remove Program Control panel
	mSystem.setStartAtLogin(false);      // removes shortcut from Windows "Startup" folder
	mApplication.deleteSelf(true);     // deletes the application and it's containing folder
	mApplication.quit();
}

// Removes Application from the Windows Add Remove Program control panel
// This code will no have effect on the Mac
function deleteAddRemoveProgramEntry(productName:String) {
	mRegistry.deleteValue(uninstallKey, "DisplayName");
	mRegistry.deleteValue(uninstallKey, "UninstallString");
	mRegistry.deleteValue(uninstallKey, "Publisher");
	mRegistry.deleteValue(uninstallKey, "DisplayVersion");
	mRegistry.deleteValue(uninstallKey, "HelpLink");
	mRegistry.deleteValue(uninstallKey, "URLInfoAbout");
	mRegistry.deleteKey("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\", productName);
}