| Previous | Next |
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.
| Questions or Feedback? | Previous | Next |
- AS2 Migration
- Getting Started - Flash
- Debugging in Flash
- Building your application from inside Flash
- Getting Started - Flex
- Debugging in Flex
- Using mProjector - Compile Your SWF into an Appli
- Customizing The About Window
- Debugging Your Application
- Launching Application at Startup
- Mac vs. Windows Application Development
- Menus
- Dynamic Window Creation
- Application Basics
- mProjector Class Basics
- Add Remove Programs Control Panel
- Fullscreen and Center
- Check Connection and Download File
- Choose Files
- Creating an Installer
- Creating and Controlling Multiple Windows
- Cut, Copy, and Paste (Windows)
- Desktop Shortcut and Start Menu Support
- Drag and Drop Files
- Embedding HTML and other Media types
- Flash-Shaped Windows
- Message Box
- Open Documents
- Project Files
- Reading and Writing to Hard Drive
- Startup Application
- Wallpaper and Screensaver
- Window to Window Communications
- Working with Included Files
- Context Sensitive Menus
- Alert User
- Screen Resolution
