views:

543

answers:

4
NativeApplication.nativeApplication.icon.bitmaps = bitmapData();

I wrote coding in my project for sysTrayIcon display but got error like

NativeApplication.nativeApplicationSeverity and Description 
Path Resource   
Implicit coercion of a value of type flash.display:BitmapData to an unrelated type Array.   toy/src toy.mxml .icon.bitmaps = bitmapData();

What mistake did I make, or could you tell me the meaning of this error?

A: 

I think you need a typecast in there such as:

SystemTrayIcon(NativeApplication.nativeApplication.icon).bitmaps

The SystemTrayIcon is a Windows-specific class I believe.

var sysTrayIcon:SystemTrayIcon = NativeApplication.nativeApplication.icon as SystemTrayIcon;ok i tried this code also
R.Vijayakumar
i tried SystemTrayIcon(NativeApplication.nativeApplication.icon).bitmaps but got same error y ?
R.Vijayakumar
+1  A: 

Icon.bitmaps is an Array of BitmapData, with one BitmapData instance for each size. You must reassign the entire array:

NativeApplication.nativeApplication.icon.bitmaps = new Array(bitmapData);

Alternatively, as the livedocs mention, you can specify all the bitmap sizes:

NativeApplication.nativeApplication.icon.bitmaps = 
    new Array(icon16x16.bitmapData, icon128x128.bitmapData);
Richard Szalay
wooow !!! thank you so much Richard Szalay . it's very usefule to me
R.Vijayakumar
No worries. If it answered your question to the point where you don't need to wait for a better answer, you can mark it as "the answer" by clicking the tick on the left.
Richard Szalay
A: 

This is the discussion about this topic from Adobe:

http://livedocs.adobe.com/flex/3/html/help.html?content=taskbar_1.html

Freddie
A: 

I want to know, is it only for systrayicon? or we can use as a desktop icon too?

Is anyone explain exatly what should i do to create a systrayicon and....

navibd