deepa and matt posted this a while back...  might solve your problem...

<?xml version="1.0" encoding="iso-8859-1"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">

<mx:Script><![CDATA[
[Embed(source="b.jpg")]
var iconFilter:String;

//For each child Menu, set an iconFunction
function setMyIcons(mb){
    var len = mb.dataProvider.childNodes.length;
    for (var i=0; i < len; i++){
        var m = mb.getMenuAt(i);
        m.iconFunction = mx.utils.Delegate.create(this, myCallBack);
    }
}

//If the 'icon' attribute is set in the XML obj, return the icon name
function myCallBack(item){
    if (item.attributes.icon != null){
        return this[item.attributes.icon];
    }
    else {
        return undefined;
    }
}

]]></mx:Script>

<mx:XML id="dp1">
        <menuitem label="Tools">
            <menuitem label="Communications"/>
            <menuitem type="separator"/>
            <menuitem label="Filters" icon="iconFilter"/>
            <menuitem type="separator"/>
            <menuitem label="Mass Updates">
            <menuitem label="Billing"/>
         </menuitem>
    </menuitem>
    <menuitem label="Tools">
            <menuitem label="Communications"/>
            <menuitem type="separator"/>
            <menuitem label="Filters" icon="iconFilter"/>
            <menuitem type="separator"/>
            <menuitem label="Mass Updates">
            <menuitem label="Billing"/>
         </menuitem>
    </menuitem>
    <menuitem label="Tools">
            <menuitem label="Communications"/>
            <menuitem type="separator"/>
            <menuitem label="Filters" icon="iconFilter"/>
            <menuitem type="separator"/>
            <menuitem label="Mass Updates">
            <menuitem label="Billing"/>
         </menuitem>
    </menuitem>
</mx:XML>

<mx:MenuBar id="mb2" dataProvider="{dp1}" creationComplete="setMyIcons(mb2);"/>

</mx:Application>

On 7/23/05, Devin Holloway <[EMAIL PROTECTED]> wrote:
I was adding icons to the menus in the MenuBar.

<mx:Script>
<![CDATA[
[Embed(source="icons/printpreview.gif")]
var printpreview:String;

[Embed(source="icons/print.gif")]
var print:String;
]]>
</mx:Script>

<mx:MenuBar>
<mx:dataProvider>
  <mx:XML>
   <menuitem label="File">
    <menuitem label="Print Preview" icon="{printpreview}"/>
    <menuitem label="Print..." icon="{print}"/>

When I added the icon for "print preview", it worked fine. Then I
added the icon for "print", and it showed up, but the "print preview"
icon disapeared. So then I removed the icon from "print", and
the "print preview" one reappeared. It's only allowing me to have one
or the other, but not both!




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Computer software testing Macromedia flex Development
Software developer


YAHOO! GROUPS LINKS




Reply via email to