title: How to add icons to a PopUpMenuButton in Flex 3 using an XML file
body: <p>I've been looking at the following example for populating a PupUpMenuButton <a href="http://blog.flexexamples.com/2008/02/21/creating-a-custom-label-function-on-a-flex-popupmenubutton-control/" rel="nofollow noreferrer">http://blog.flexexamples.com/2008/02/21/creating-a-custom-label-function-on-a-flex-popupmenubutton-control/</a> 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 </p>
  
  <p>(seems I can't include more than one url, but it is an example that creates a menu object using the following function):</p>
  
  <pre><code>private function initMenu():void {
              menu = new Menu();
              menu.dataProvider = xmlList;
              menu.labelField = "@label";
              menu.iconField = "@icon";
          }
  </code></pre>
  
  <p>but I would really prefer to build it all from the XML file.</p>
  
  <p>Many thanks,</p>
  
  <p>Bryn</p>