mApplication.bounceDockIcon()

Availability

Windows: Not Applicable

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

Usage

mApplication.bounceDockIcon(repeats:Boolean) : Void

Parameters

repeats - A value of true means the icon will continue to bounce until the command is called again with a false. Sending repeats=false will bounce the icon twice then stop.

Returns

Nothing.

Description

Method; Bounces icon in the Mac OS X Dock to alert the user your application needs attention. This command will NOT bounce the icon when your application is the active application.

Example

This example bounces the animates the Dock icon when alertUser(true) is called and stops the animation when alertUser(false) is called. It also contains code for an analogous solution on the PC for the System Tray icon.

// Start Animation
// Mac: 	bounces icon using Mac API
// Windows: sets draw rect in SWF for System Tray icon and starts the animation
startIconAnimation = function() {
	if (mSystem.isMac()) {
		mApplication.bounceDockIcon(true);
	} else {
		mApplication.setSystemTrayIcon(1,1); // start drawing icon from upper left of SWF
		gotoAndPlay(3);						 // start animating icon in SWF
	}
}
// Stop Animation
// Mac: 	stops bounce
// Windows: stops icon redraw, resets icon to exe icon
stopIconAnimation = function() {
	if (mSystem.isMac()) {
		mApplication.bounceDockIcon(false);
	} else {
		mApplication.setSystemTrayIcon(-1,-1); // Stops drawing icon from SWF
		mApplication.showInSystemTray(false);  // Resets the icon... 
		mApplication.showInSystemTray(true);   // to be the exe icon.
		gotoAndPlay(1); 					   // goto frame that doesn't animate icon
	}
}

// onActivate event handler
// starts icon animation
alertUser  = function(activate:Boolean) {
	if ((!activate) and (current_runmode == "background_app")) {
		startIconAnimation();      
	} else if (activate) {
		current_runmode = "visible_app";    // reset state to visible app 
		stopIconAnimation(); 				// stops animation on Windows 
	}
}

See Also

mApplication.setDockIconBadge(), mApplication.setSystemTrayIcon(), mApplication.setSystemTrayIconFile(), mApplication.showInSystemTray(), mApplication.onSystemTray(), mApplication.flashTaskBarButton(), mWindow.flashTaskBarButton()

Code Examples

Animating the Dock or System Tray Icon