How to add icons to a PopUpMenuButton in Flex 3 using an XML file
Posted
by user168610
on Stack Overflow
See other posts from Stack Overflow
or by user168610
Published on 2009-09-04T16:05:01Z
Indexed on
2010/03/21
1:01 UTC
Read the original article
Hit count: 738
Hi,
I've been looking at the following example for populating a PupUpMenuButton http://blog.flexexamples.com/2008/02/21/creating-a-custom-label-function-on-a-flex-popupmenubutton-control/ and would like to add icons to each menu. Ideally, I would specify the icon in the xml and assign it in a similar way to using labelFunction for the text. I'm pretty new to Flex and would appreciate some guidance with this. The only information I've found via google is to create a menu as follows
(seems I can't include more than one url, but it is an example that creates a menu object using the following function):
private function initMenu():void {
menu = new Menu();
menu.dataProvider = xmlList;
menu.labelField = "@label";
menu.iconField = "@icon";
}
but I would really prefer to build it all from the XML file.
Many thanks,
Bryn
© Stack Overflow or respective owner