Wallpaper and screensaver

This sample demonstrates how to change the active wallpaper and screensaver.

The sample uses mSystem.chooseFile() to enable the user to identify a .jpg file for the wallpaper. Once selected, the user can set the active wallpaper by clicking the "Set Active Wallpaper" button, which calls the following onPress function.

setActiveWallpaper_btn.onRelease = function() {
	if (mFile.fileExists(wallpaperPath)) {
		mApplication.trace("setActiveWallpaper: " + wallpaperPath);
		mSystem.setActiveWallpaper(wallpaperPath);
	} else {
		mApplication.trace("file does not exist:" + wallpaperPath);
	}
};

The sample also creates a list of installed screensavers by looking through the screensaver directory for .scr files. The command mSystem.getSpecialFolder() is used to get the path to the screensaver directory, and mFile.listFiles() is used to create the list of files in the directory. Once the combobox is populated with the names of the available screensavers, the user can set the active screensaver by choosing one, and then clicking the "Set Active screensaver" button, which calls the following onPress function.

setActiveScreenSaver_btn.onRelease = function() {
	var fullPathOfScreenSaver:String = "";
	mApplication.trace("activate: " + saver_cb.selectedItem.label);
	if (saver_cb.selectedItem.label.length > 0 ) {
		fullPathOfScreenSaver = screenSaverFolder + saver_cb.selectedItem.label+saverExtension;
		mSystem.setActiveScreenSaver(fullPathOfScreenSaver);
	} 
};

You can download this sample, "Wallpaper and screensaver", from the mProjector Samples page -- /software/flash-projector/flas.html#wallpaperAndScreensaver.