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.

kamagra sildenafil citrate pas cher precio tadalafil