Adobe® AIR® API Reference for HTML Developers
Home  |  Show Classes List |  Index  |  Appendixes

Language Reference only       
DockIcon 
3D:
Context3D
Context3DBlendFactor
Context3DClearMask
Context3DCompareMode
Context3DProgramType
Context3DRenderMode
Context3DStencilAction
Context3DTextureFormat
Context3DTriangleFace
Context3DVertexBufferFormat
CubeTexture
IndexBuffer3D
Program3D
Stage3D
Texture
VertexBuffer3D
Air.net:
ServiceMonitor
SocketMonitor
URLMonitor
Air.update:
ApplicationUpdater
ApplicationUpdaterUI
DownloadErrorEvent
StatusFileUpdateErrorEvent
StatusFileUpdateEvent
StatusUpdateErrorEvent
StatusUpdateEvent
UpdateEvent
Data:
EncryptedLocalStore
SQLCollationType
SQLColumnNameStyle
SQLColumnSchema
SQLConnection
SQLError
SQLErrorEvent
SQLErrorOperation
SQLEvent
SQLIndexSchema
SQLMode
SQLResult
SQLSchema
SQLSchemaResult
SQLStatement
SQLTableSchema
SQLTransactionLockType
SQLTriggerSchema
SQLUpdateEvent
SQLViewSchema
Desktop:
Clipboard
ClipboardFormats
ClipboardTransferMode
DockIcon
Icon
InteractiveIcon
NativeApplication
NativeProcess
NativeProcessStartupInfo
NotificationType
SystemTrayIcon
Display:
BitmapData
NativeMenu
NativeMenuItem
Screen
Stage
StageDisplayState
StageQuality
Events:
ActivityEvent
AsyncErrorEvent
BrowserInvokeEvent
DataEvent
DatagramSocketDataEvent
DNSResolverEvent
DRMAuthenticateEvent
DRMStatusEvent
ErrorEvent
Event
EventDispatcher
FileListEvent
HTTPStatusEvent
InvokeEvent
InvokeEventReason
IOErrorEvent
LocationChangeEvent
MouseEvent
NativeProcessExitEvent
NetDataEvent
NetMonitorEvent
NetStatusEvent
OutputProgressEvent
ProgressEvent
SampleDataEvent
SecurityErrorEvent
ServerSocketConnectEvent
StatusEvent
StorageVolumeChangeEvent
TimerEvent
UncaughtErrorEvent
UncaughtErrorEvents
File:
File
FileMode
FileStream
StorageVolume
StorageVolumeInfo
Functions:
trace()
generateRandomBytes()
navigateToURL()
sendToURL()
Geom:
Matrix
Point
Rectangle
Media:
AudioDecoder
AudioPlaybackMode
H264Level
H264Profile
H264VideoStreamSettings
ID3Info
InputMediaStream
Microphone
MicrophoneEnhancedMode
MicrophoneEnhancedOptions
Sound
SoundChannel
SoundCodec
SoundLoaderContext
SoundMixer
SoundTransform
VideoCodec
VideoStatus
VideoStreamSettings
Native window:
NativeWindow
NativeWindowBoundsEvent
NativeWindowDisplayState
NativeWindowDisplayStateEvent
NativeWindowInitOptions
NativeWindowRenderMode
NativeWindowResize
NativeWindowSystemChrome
NativeWindowType
Net:
AAAARecord
ARecord
CertificateStatus
DatagramSocket
DNSResolver
FileFilter
InterfaceAddress
IPVersion
LocalConnection
MXRecord
NetConnection
NetMonitor
NetStreamAppendBytesAction
NetStreamMulticastInfo
NetworkInfo
NetworkInterface
ObjectEncoding
PTRRecord
ResourceRecord
Responder
SecureSocket
ServerSocket
SharedObject
SharedObjectFlushStatus
Socket
SRVRecord
URLLoader
URLLoaderDataFormat
URLRequest
URLRequestDefaults
URLRequestHeader
URLRequestMethod
URLStream
URLVariables
XMLSocket
Security:
ReferencesValidationSetting
RevocationCheckSettings
SignatureStatus
SignerTrustSettings
X500DistinguishedName
X509Certificate
XMLSignatureValidator
System:
Capabilities
Security
System
Updater
Ui:
Keyboard
KeyboardType
KeyLocation
Mouse
MouseCursorData
Utils:
Vector
ByteArray
Collator
CollatorMode
CompressionAlgorithm
CurrencyFormatter
CurrencyParseResult
DateTimeFormatter
DateTimeNameContext
DateTimeNameStyle
DateTimeStyle
Endian
HTMLLoader
HTMLPDFCapability
LastOperationStatus
LocaleID
NationalDigitsType
NumberFormatter
NumberParseResult
StringTools
Timer
window.runtime propertywindow.runtime.flash.desktop.DockIcon
InheritanceDockIcon Inheritance InteractiveIcon Inheritance Icon Inheritance EventDispatcher Inheritance Object

Runtime Versions:  1.0

The DockIcon class represents the Mac OS X®-style dock icon.

You can use the DockIcon class to change the appearance of the standard icon; for example, to animate the icon or add informational graphics. You can also add items to the dock icon menu. The menu items that you add are displayed above the standard menu items.

An instance of the DockIcon class cannot be created. Get the object representing the operating system dock icon from NativeApplication.icon.

Not all operating systems have dock icons. Check NativeApplication.supportsDockIcon to determine whether dock icons are supported on the current system. If dock icons are supported, the NativeApplication.icon property is of type DockIcon. Otherwise, the type of NativeApplication.icon is another subclass of InteractiveIcon, typically SystemTrayIcon.

Important: Attempting to call a DockIcon class method on the NativeApplication.icon object on an operating system for which AIR does not support dock icons generates a run-time exception.

View the examples

See also



Properties
 PropertyDefined By
  bitmaps : Array
[override] The icon image as an array of BitmapData objects of different sizes.
DockIcon
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  height : int
[override] [read-only] The current display height of the icon in pixels.
DockIcon
  menu : NativeMenu
The system-supplied menu of this dock icon.
DockIcon
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
  width : int
[override] [read-only] The current display width of the icon in pixels.
DockIcon
Public Methods
 MethodDefined By
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
EventDispatcher
  
bounce(priority:String = "informational"):void
Notifies the user that an event has occurred that may require attention.
DockIcon
 Inherited
dispatchEvent(event:Event):Boolean
Dispatches an event into the event flow.
EventDispatcher
 Inherited
hasEventListener(type:String):Boolean
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
EventDispatcher
 Inherited
hasOwnProperty(name:String):Boolean
Indicates whether an object has a specified property defined.
Object
 Inherited
isPrototypeOf(theClass:Object):Boolean
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
propertyIsEnumerable(name:String):Boolean
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
EventDispatcher
 Inherited
setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
toLocaleString():String
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
toString():String
Returns the string representation of the specified object.
Object
 Inherited
valueOf():Object
Returns the primitive value of the specified object.
Object
 Inherited
willTrigger(type:String):Boolean
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
EventDispatcher
Events
 Event Summary Defined By
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active.EventDispatcher
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive.EventDispatcher
Property Detail

bitmaps

property
bitmaps:Array[override]

Runtime Versions:  1.0

The icon image as an array of BitmapData objects of different sizes.

When an icon is displayed in a given operating system context, the bitmap in the array closest to the displayed size is used (and scaled if necessary). Common sizes include 16x16, 32x32, 48x48, and 128x128. (512x512 pixel icons may be used for some operating system icons in the near future.)

In some contexts, the operating system may use a default system icon if nothing has been assigned to the bitmaps property. In other contexts, no icon appears.

To set or change the icon appearance, assign an array of BitmapData objects to the bitmaps property:

     icon.bitmaps = new Array(icon16x16.bitmapData, icon128x128.bitmapData);

     

Modifying the bitmaps array directly has no effect.

To clear the icon image, assign an empty array to the bitmaps property.

Note: When loading image files for an icon, the PNG file format generally provides the best alpha blending. The GIF format supports only on or off transparency (no blending). The JPG format does not support transparency at all.

height

property 
height:int  [read-only] [override]

Runtime Versions:  1.0

The current display height of the icon in pixels.

Some icon contexts support dynamic sizes. The height property indicates the height of the icon chosen from the bitmaps array for the current context. The actual display height may be different if the operating system has scaled the icon.

menu

property 
menu:NativeMenu

Runtime Versions:  1.0

The system-supplied menu of this dock icon.

Any items in the menu are displayed above the standard items. The standard items cannot be modified or removed.


Example  ( How to use this example )
The following example adds an item to the dock icon menu:
 
function createDockIconMenu(){
    if(air.NativeApplication.supportsDockIcon){                
        var dockIcon = air.NativeApplication.nativeApplication.icon;
        
        var dockMenu = new air.NativeMenu();
        var command = dockMenu.addItem(new air.NativeMenuItem("Command"));
        command.addEventListener(air.Event.SELECT, onCommand);
        
        dockIcon.menu = dockMenu;
    }
}

function onCommand(event){
     //do command...
}

width

property 
width:int  [read-only] [override]

Runtime Versions:  1.0

The current display width of the icon in pixels.

Some icon contexts support dynamic sizes. The width property indicates the width of the icon chosen from the bitmaps array for the current context. The actual display width may be different if the operating system has scaled the icon.

Method Detail

bounce

()method
public function bounce(priority:String = "informational"):void

Runtime Versions:  1.0

Notifies the user that an event has occurred that may require attention.

Calling this method bounces the dock icon if, and only if, the application is in the background. If the priority is NotificationType.Informational then the icon bounces once. If the priority is NotificationType.Critical then the icon bounces until the application is brought to the foreground.

Parameters

priority:String (default = "informational") — The urgency with which to bounce the dock.

See also


Example  ( How to use this example )

The following example bounces the dock icon until the user activates the application:
 if(air.NativeApplication.supportsDockIcon){
     var dockIcon = air.NativeApplication.nativeApplication.icon;
     dockIcon.bounce(air.NotificationType.CRITICAL);
 }
 
Examples

The following example loads a sequence of images and, when the timer is started with the dock icon menu, animates the icon image. (For the example to work, you must supply a set of icon images and change the URLs in the imageURLs array.)
 <script>
        var imageURLs =  ['gfx/frame01.png',
                          'gfx/frame02.png',
                          'gfx/frame03.png',
                          'gfx/frame04.png'];
        
         var images = new Array();
         var animTimer;
                                        
         function initAnimatedDockIcon()
        {
            air.NativeApplication.nativeApplication.autoExit = false;
            loadImages();
            addMenu();
                        
            window.nativeWindow.visible = false;
        }
        
        function addMenu(){
            var menu = new air.NativeMenu();
            var start = menu.addItem(new air.NativeMenuItem("Start animation"));
            var stop = menu.addItem(new air.NativeMenuItem("Stop animation"));
            start.addEventListener(air.Event.SELECT, startTimer);
            stop.addEventListener(air.Event.SELECT, stopTimer);
            
            var dockIcon =    air.NativeApplication.nativeApplication.icon;
            dockIcon.menu = menu;
        }
        
        function startTimer(event){
            clearInterval(animTimer);
            animTimer = setInterval(advanceFrame, 100);
        }

        function stopTimer(event){
            clearInterval(animTimer);
        }

        var currentFrame = 0;
        function advanceFrame(event){
            if(currentFrame < images.length - 1){
                currentFrame++;
            } else {
                currentFrame = 0;
            }
            air.trace(currentFrame);
            air.NativeApplication.nativeApplication.icon.bitmaps = [images[currentFrame]];
        }
        

        function loadImages(event){
            if(event != null){
                images.push(event.target.content.bitmapData);
            }
            if(imageURLs.length > 0){
                var urlString = imageURLs.pop();
                var loader = new air.Loader();
                loader.contentLoaderInfo.addEventListener(air.Event.COMPLETE, loadImages, false, 0, true);
                loader.load(new air.URLRequest(urlString));
            } else {
                animTimer = setInterval(advanceFrame, 100);
            }
        }
</script>