Menu icons not displayed

View: New views
6 Messages — Rating Filter:   Alert me  

Menu icons not displayed

by D Unit :: Rate this Message:

| View Threaded | Show Only this Message

I am having a tough time getting icons to display within a drop down Menu on a Menubar.

I have a menu bar with the following MXML:

        <mx:MenuBar
                xmlns:mx="http://www.adobe.com/2006/mxml"
                labelField="@label"
                iconField="@icon"
                width="100%">
                <mx:XMLList>
                        <item label="Application" icon="configure16">
                                <item label="Options" icon="configure16/>
                                <item type="separator"/>
                                <item label="Exit"/>
                        </item>......

'configure16' is an embedded image:

[Embed(source="../assets/icons_16/configure.png")]
public static const configure16:Class;

The icon is displayed correctly on the MenuBar (Application item), but it is not displayed at all on the drop down menu (Options item). How can I get an icon to display next to an entry on a drop down menu?

RE: Menu icons not displayed

by j_lafferty :: Rate this Message:

| View Threaded | Show Only this Message

You are missing a quotation mark in your dataProvider:

<item label="Options" icon="configure16/>

 

I think that is your problem because I can see an icon in the main menu
item and its submenus.

 

Joan

 

________________________________

From: flexcoders@... [mailto:flexcoders@...] On
Behalf Of D Unit
Sent: Thursday, January 31, 2008 12:30 PM
To: flexcoders@...
Subject: [flexcoders] Menu icons not displayed

 


I am having a tough time getting icons to display within a drop down
Menu on
a Menubar.

I have a menu bar with the following MXML:

<mx:MenuBar
xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> "
labelField="@label"
iconField="@icon"
width="100%">
<mx:XMLList>
<item label="Application" icon="configure16">
<item label="Options" icon="configure16/>
<item type="separator"/>
<item label="Exit"/>
</item>......

'configure16' is an embedded image:

[Embed(source="../assets/icons_16/configure.png")]
public static const configure16:Class;

The icon is displayed correctly on the MenuBar (Application item), but
it is
not displayed at all on the drop down menu (Options item). How can I get
an
icon to display next to an entry on a drop down menu?
--
View this message in context:
http://www.nabble.com/Menu-icons-not-displayed-tp15214090p15214090.html
<http://www.nabble.com/Menu-icons-not-displayed-tp15214090p15214090.html
>
Sent from the FlexCoders mailing list archive at Nabble.com.

 


RE: Menu icons not displayed

by D Unit :: Rate this Message:

| View Threaded | Show Only this Message

That was just a copy-paste error. I'm using Flex 3 Beta 2.

Joan Lafferty wrote:
You are missing a quotation mark in your dataProvider:

<item label="Options" icon="configure16/>

 

I think that is your problem because I can see an icon in the main menu
item and its submenus.

 

Joan

 

________________________________

From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On
Behalf Of D Unit
Sent: Thursday, January 31, 2008 12:30 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Menu icons not displayed

 


I am having a tough time getting icons to display within a drop down
Menu on
a Menubar.

I have a menu bar with the following MXML:

<mx:MenuBar
xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> "
labelField="@label"
iconField="@icon"
width="100%">
<mx:XMLList>
<item label="Application" icon="configure16">
<item label="Options" icon="configure16/>
<item type="separator"/>
<item label="Exit"/>
</item>......

'configure16' is an embedded image:

[Embed(source="../assets/icons_16/configure.png")]
public static const configure16:Class;

The icon is displayed correctly on the MenuBar (Application item), but
it is
not displayed at all on the drop down menu (Options item). How can I get
an
icon to display next to an entry on a drop down menu?
--
View this message in context:
http://www.nabble.com/Menu-icons-not-displayed-tp15214090p15214090.html
<http://www.nabble.com/Menu-icons-not-displayed-tp15214090p15214090.html
>
Sent from the FlexCoders mailing list archive at Nabble.com.

 

Re: Menu icons not displayedMore info

by D Unit :: Rate this Message:

| View Threaded | Show Only this Message

So after playing around with this mxml, I've found that if I place the mxml for the menubar within the main application mxml tag, then everything works. However, if I put the menubar mxml in a separate file and include it within the application mxml, then the sub-menu icons are not displayed. Is this a Flex bug, or am I missing something?

D Unit wrote:
I am having a tough time getting icons to display within a drop down Menu on a Menubar.

I have a menu bar with the following MXML:

        <mx:MenuBar
                xmlns:mx="http://www.adobe.com/2006/mxml"
                labelField="@label"
                iconField="@icon"
                width="100%">
                <mx:XMLList>
                        <item label="Application" icon="configure16">
                                <item label="Options" icon="configure16/>
                                <item type="separator"/>
                                <item label="Exit"/>
                        </item>......

'configure16' is an embedded image:

[Embed(source="../assets/icons_16/configure.png")]
public static const configure16:Class;

The icon is displayed correctly on the MenuBar (Application item), but it is not displayed at all on the drop down menu (Options item). How can I get an icon to display next to an entry on a drop down menu?

Re: Menu icons not displayedMore info

by blagger :: Rate this Message:

| View Threaded | Show Only this Message

D Unit wrote:
So after playing around with this mxml, I've found that if I place the mxml for the menubar within the main application mxml tag, then everything works. However, if I put the menubar mxml in a separate file and include it within the application mxml, then the sub-menu icons are not displayed. Is this a Flex bug, or am I missing something?
I've encountered a similar problem. I've uploaded some sample code :
TestMenuIcons.zip

Basically, I'm embedding some icon resources to use them in popup menus. I have an ActionScript file that embeds the resources and assigns them to a classname - the usual technique. I then wish to populate a menu using some XML as a dataprovider, with the icons being declared appropriately.

In the Main.mxml, you can see three approaches to popping up a menu. They all use similarly-formatted XML, yet they differ in the manner in which they access the embedded resources.

Only the third approach works, when it would seem reasonable that they all should work.

Re: Menu icons not displayedMore info

by blagger :: Rate this Message:

| View Threaded | Show Only this Message

Replace the Main.mxml file with this new Main.mxml.

Note the addition of the embedded resource definitions at the top. These are duplicated from where they are originally declared. It seems ridiculous to have to duplicate every resource definition at the Application level, as well as where they are really needed to compile.

Now I need to understand why this works. Is there a scoping bug in Flex with respect to menu icons? As demonstrated, the embedded resources work perfectly for images...