| Previous | Next |
Animating the Dock or System Tray Icon -- Alert User
This sample shows you how to add a dynamic icon to the PC system tray or Mac status menu.
Call mApplication.showInSystemTray() to display your application's standard icon in the system tray (PC) or status menu (Mac)
You can display an animated icon by calling mApplication.setSystemTrayIconFromFile() repeatedly passing a series of icons.
//
// Animate System Tray (PC) or Status Menu (Mac) Icons
//
// this animation is created by cycling through
// a sequence of 6 icons.
// for PC: square-1.ico, square-2.ico, etc.
// for Mac: square-1.icns, square-2.icns, etc.
//
// initialize the system specific icon file extension
if (mSystem.isMac()) {
iconExtension = ".icns";
} else if (mSystem.isWindows()) {
iconExtension = ".ico";
}
var iconFilePath = "";
var currentIcon = 0;
var iconIntervalId = 0;
//
// change the system tray / status meun icon
//
function changeIcon() {
if (currentIcon == 6) {
currentIcon = 1;
} else {
currentIcon++;
}
var iconFilePath = "square-"+currentIcon+iconExtension;
mApplication.setSystemTrayIconFromFile(iconFilePath);
mApplication.showInSystemTray(true);
}
//
// start the system tray / status meun animation
//
function startAlert() {
mApplication.trace("startAlert ------");
iconIntervalId = setInterval(changeIcon, 50);
mApplication.trace("startAlert complete ------");
}
//
// stop the system tray / status meun animation
//
function stopAlert() {
mApplication.trace("stopAlert ------");
clearInterval(iconIntervalId);
mApplication.setSystemTrayIconFromFile("");
mApplication.trace("stopAlert complete ------");
}
You can download this sample, "Alert User", from the mProjector Samples page -- /software/flash-projector/flas.html#alertUser.
| Questions or Feedback? | Previous | Next |
More Information
Getting Started
ActionScript 3.0 Support
- AS2 Migration
- Getting Started - Flash
- Debugging in Flash
- Building your application from inside Flash
- Getting Started - Flex
- Debugging in Flex
ActionScript 3.0 Samples
Using mProjector
- 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
ActionScript 2.0 Samples
- 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
