Thanks for your help, but no, it does not solve the problem. Perhaps Adobe or others could contribute to this for a better solution, or be aware of the bugs/items/work arounds.

 

A couple of things with this control. After a little testing.

 

1: The lableFunction does not work at all. No matter what method chosen.

   

2: Icons are not working at all.

    2a: not with out 3a and/or 3b

 

3: There is no iconField like in the menu. there is in the popup menu component however can't get at it design time and it's set to icon (which = no icon for xml as I need to use @icon).

    3a: The solution to the above for an icon in the popup is on the creation complete event set it to @label like so "event.currentTarget.popUp.iconField = "@icon";"

    3b: or subclass the popupmenubutton, add the property, and do it there.

 

4: I think that checking or un-checking the menu check spot should not close the popup, but still dispatch item Click, or change event.

 

5: The icon shows when bound to a object array only. As per the docs, specify xml possibilities as well.

    5a: See 3a and 3b for solution

 

6: When bound to and object array, and icon is showing. In the menu drop down portion with each click on the menu item in the drop down the icon becomes progressively muddy, seems it's not be cleared for each drop down. Or being redrawn over top of.

    6a: Solution is to use xml and 3a or 3b then the icon displays properly

 

7: When using a xml data source and icons working the icon will not show in the button itself until you select an item as the object method does.

    7a: 3b may be able to fix this.

 

 

This is the code to demonstrate the behavior described above. Hopefully with all this others will not have the same problems I have.

 
Cheers,
 
Jason

 

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns="mx.controls.*" xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

<mx:Script>
  <![CDATA[
        [Embed(source="Shared_Assets/Icons/00002.png")]
        public var exitOn:Class;

        [Bindable]
        public var menuXml:XML = XML(<items>
      <item label="Inbox" icon="exitOn" />
      <item label="Calendar"/>
      <item label="Sent"/>
      <item label="Deleted Items"/>
      <item label="Spam"/>
     </items>);
  
  [Bindable]  
        public var menuObject:Array = [{label: "Inbox",icon:"exitOn"},
                                   {label: "Calendar"},
                                   {label: "Sent"},
                                   {label: "Deleted Items"},
                                   {label: "Spam"}];

  
  
  private function getLabel(item:Object):String{
   return "this does not work";
  }
  
  private function handleCustome(event:Event):void{
   event.currentTarget.popUp.iconField = "@icon";
  }
  
  ]]>
 </mx:Script>

 <!--xml data source-->
 <mx:PopUpMenuButton labelField="@label"  creationComplete="handleCustome(event)" height="22" cornerRadius="0" dataProvider="{menuXml.children()}" id="test" x="84" y="40" />

 <!--object array data source-->
 <mx:PopUpMenuButton height="22" cornerRadius="0" dataProvider="{menuObject}" id="test2" x="312" y="40" />

 <mx:Label x="10" y="42" text="XML Bound"/>
 <mx:Label x="225" y="42" text="Object Bound"/>
 
</mx:Application>

 
 
 
-----Message d'origine-----
De : [email protected] [mailto:[EMAIL PROTECTED]De la part de Tim Hoff
Envoyé : mardi 4 juillet 2006 21:10
À : [email protected]
Objet : [flexcoders] Re: Flex 2 Icon in PopUpMenuButton

Hi Jason,

Kelly Birr addressed this topic a week ago for a MenuBar.  The same solution will work for a PopUpMenuButton.  They both use the Menu class.

http://groups.yahoo.com/group/flexcoders/message/41282?l=1 

The icon string in your dataProvider has to be the same name as the class variable that references the icon asset.

-TH

--- In [email protected], "sourcecoderia" <[EMAIL PROTECTED]> wrote:
>
> Any Idea how one could set the icon, tried a few things but dosn't seem
> to be working. I want an icon on the individual menu items. The data
> source does have the icon set as a string and the asset is available to
> the control.
>
> Any Ideas ?
>
> Jason
>

__._,_.___

--
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




__,_._,___

Reply via email to