<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Displaying icons in a Flex PopUpButton control (Redux)</title>
	<atom:link href="http://blog.flexexamples.com/2009/01/20/displaying-icons-in-a-flex-popupbutton-control-redux/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com/2009/01/20/displaying-icons-in-a-flex-popupbutton-control-redux/</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Sun, 12 Feb 2012 14:19:03 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Shreya</title>
		<link>http://blog.flexexamples.com/2009/01/20/displaying-icons-in-a-flex-popupbutton-control-redux/comment-page-1/#comment-10289</link>
		<dc:creator>Shreya</dc:creator>
		<pubDate>Tue, 03 Jan 2012 06:16:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2009/01/20/displaying-icons-in-a-flex-popupbutton-control-redux/#comment-10289</guid>
		<description>Pasting my cleaned code again:
Actionscript File:
package
{
	import flash.events.Event;
	
	import mx.binding.utils.BindingUtils;
	import mx.controls.Menu;
	import mx.controls.PopUpButton;
	import mx.events.FlexEvent;
	import mx.events.MenuEvent;
	
	public class CollectionViewAction extends PopUpButton
	{
		
		[Bindable]
		private var menu:Menu;
		[Embed(&quot;assets/New16.png&quot;)]
		public const ButtonIcon:Class;
		[Bindable]
		public static var menuDataXML:XML =
			
				
				
				
				
				
				
				
					
				
				
			;
		[Bindable]
		public static var menuXMLL:XMLList;
		
		public function CollectionViewAction()
		{
			super();
			menu = new Menu();
			this.popUp=menu;
			this.addEventListener(FlexEvent.PREINITIALIZE, initData,false,0,true);
			
		}
		private function initData(e:Event):void 
		{
			menuXMLL=menuDataXML.children();
			menu.dataProvider = menuXMLL;
			menu.labelField = &quot;@label&quot;;
			menu.iconField = &quot;@icon&quot;;
			
		}
			
	}
}

Can you please tell me what can I do to display the icons?
My actionscript code is same as the mxml code above, but the icons are not getting displayed at all.
Thanks in advance!!</description>
		<content:encoded><![CDATA[<p>Pasting my cleaned code again:<br />
Actionscript File:<br />
package<br />
{<br />
	import flash.events.Event;</p>
<p>	import mx.binding.utils.BindingUtils;<br />
	import mx.controls.Menu;<br />
	import mx.controls.PopUpButton;<br />
	import mx.events.FlexEvent;<br />
	import mx.events.MenuEvent;</p>
<p>	public class CollectionViewAction extends PopUpButton<br />
	{</p>
<p>		[Bindable]<br />
		private var menu:Menu;<br />
		[Embed("assets/New16.png")]<br />
		public const ButtonIcon:Class;<br />
		[Bindable]<br />
		public static var menuDataXML:XML =</p>
<p>			;<br />
		[Bindable]<br />
		public static var menuXMLL:XMLList;</p>
<p>		public function CollectionViewAction()<br />
		{<br />
			super();<br />
			menu = new Menu();<br />
			this.popUp=menu;<br />
			this.addEventListener(FlexEvent.PREINITIALIZE, initData,false,0,true);</p>
<p>		}<br />
		private function initData(e:Event):void<br />
		{<br />
			menuXMLL=menuDataXML.children();<br />
			menu.dataProvider = menuXMLL;<br />
			menu.labelField = &#8220;@label&#8221;;<br />
			menu.iconField = &#8220;@icon&#8221;;</p>
<p>		}</p>
<p>	}<br />
}</p>
<p>Can you please tell me what can I do to display the icons?<br />
My actionscript code is same as the mxml code above, but the icons are not getting displayed at all.<br />
Thanks in advance!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shreya</title>
		<link>http://blog.flexexamples.com/2009/01/20/displaying-icons-in-a-flex-popupbutton-control-redux/comment-page-1/#comment-10288</link>
		<dc:creator>Shreya</dc:creator>
		<pubDate>Tue, 03 Jan 2012 06:11:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2009/01/20/displaying-icons-in-a-flex-popupbutton-control-redux/#comment-10288</guid>
		<description>Hi, I want the same thing working in actionscript instead of mxml. I converted this mxml code to AS(but my cons are not getting displayed) as follows:
CollectionAction.as File
package
{
	import flash.events.Event;
	
	import mx.binding.utils.BindingUtils;
	import mx.controls.Menu;
	import mx.controls.PopUpButton;
	import mx.events.FlexEvent;
	import mx.events.MenuEvent;
	
	public class CollectionViewAction extends PopUpButton
	{
		
		[Bindable]
		private var menu:Menu;
		//[Bindable]
		[Embed(source=&quot;assets/New16.png&quot;)]
		public const printIcon:Class;
		[Embed(source=&quot;New16.png&quot;)]
		public const printIcon1:Class;
		[Embed(&quot;assets/New16.png&quot;)]
		public const ButtonIcon:Class;
		[Bindable]
		public static var menuDataXML:XML =
			
				
				
				
				
				
				
				
					
				
				
			;
		[Bindable]
		public static var menuXMLL:XMLList;
		
		public function CollectionViewAction()
		{
			super();
			menu = new Menu();
			this.popUp=menu;
			//this.addEventListener(FlexEvent.CREATION_COMPLETE, initData,false,0,true);
			this.addEventListener(FlexEvent.PREINITIALIZE, initData,false,0,true);
			
			
		}
		private function initData(e:Event):void 
		{
			//this.dataProvider = menuDataXML.menuItem;
			/*
			this.openAlways = true;
			this.labelField=&quot;@label&quot;;
			this.showRoot = true;
			this.iconField=&quot;@icon&quot;;//DropDown Action
			
			this.dataProvider = menuDataXML.children();
			//callLater(setViewDate);
			trace(&quot;PopupButton Menu$$$$&quot;);
			*/
			//menu = new Menu();
			menuXMLL=menuDataXML.children();
			menu.dataProvider = menuXMLL;
			menu.labelField = &quot;@label&quot;;
			menu.iconField = &quot;@icon&quot;;
			//BindingUtils.bindProperty((this,&quot;popUp&quot;,menu
			//this.popUp=menu;
			
		}
		/*
		private function setViewDate():void
		{
			
			this.addEventListener(&quot;itemClick&quot;,  handleItemClick,false,0,true);             
			//Menu(this.popUp).selectedIndex = 0;
				for(var i:int=0; i &lt; this.dataProvider.length;  i++)
				{
						this.label = this.dataProvider[i].@label;
						this.iconField=this.dataProvider[i].@icon; //DropDown Action
						break;
		
				}	
		}			
		public function handleItemClick(event:MenuEvent):void 
		{
	
			trace(&quot;PopupButton Menu handle item click $$$$$&quot;);
			var xml:XML = new XML(event.item);
			var str:String;
			switch(String(event.item.@data))
			{
				/*case &quot;New&quot;:trace(&quot;New&quot;);
					str=&quot;msf.foundation.actions.NewMdlObjectAction&quot;;
					//var cl:Class = str as Class;
					//var cf:ClassFactory = new ClassFactory(cl);
					//action = cf.newInstance() as AbstractAction;
					//action.setUiObject(this);
					//menuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, action.handleExecute);
					//a= new NewMdlObjectAction();
					action = new NewMdlObjectAction();
					action.setUiObject(MdlCollectionView);
					action.handleExecute(event);
					//callLater(a.handleExecute, [new Event(&quot;test&quot;)]);
					break;
				case &quot;Play&quot;:trace(&quot;Play&quot;);
					break;*/
			/*}
			
			
		}*/
	}
}

============================================


	


================================================

Can you please tell me what else I will have to do to display the icons?</description>
		<content:encoded><![CDATA[<p>Hi, I want the same thing working in actionscript instead of mxml. I converted this mxml code to AS(but my cons are not getting displayed) as follows:<br />
CollectionAction.as File<br />
package<br />
{<br />
	import flash.events.Event;</p>
<p>	import mx.binding.utils.BindingUtils;<br />
	import mx.controls.Menu;<br />
	import mx.controls.PopUpButton;<br />
	import mx.events.FlexEvent;<br />
	import mx.events.MenuEvent;</p>
<p>	public class CollectionViewAction extends PopUpButton<br />
	{</p>
<p>		[Bindable]<br />
		private var menu:Menu;<br />
		//[Bindable]<br />
		[Embed(source="assets/New16.png")]<br />
		public const printIcon:Class;<br />
		[Embed(source="New16.png")]<br />
		public const printIcon1:Class;<br />
		[Embed("assets/New16.png")]<br />
		public const ButtonIcon:Class;<br />
		[Bindable]<br />
		public static var menuDataXML:XML =</p>
<p>			;<br />
		[Bindable]<br />
		public static var menuXMLL:XMLList;</p>
<p>		public function CollectionViewAction()<br />
		{<br />
			super();<br />
			menu = new Menu();<br />
			this.popUp=menu;<br />
			//this.addEventListener(FlexEvent.CREATION_COMPLETE, initData,false,0,true);<br />
			this.addEventListener(FlexEvent.PREINITIALIZE, initData,false,0,true);</p>
<p>		}<br />
		private function initData(e:Event):void<br />
		{<br />
			//this.dataProvider = menuDataXML.menuItem;<br />
			/*<br />
			this.openAlways = true;<br />
			this.labelField=&#8221;@label&#8221;;<br />
			this.showRoot = true;<br />
			this.iconField=&#8221;@icon&#8221;;//DropDown Action</p>
<p>			this.dataProvider = menuDataXML.children();<br />
			//callLater(setViewDate);<br />
			trace(&#8220;PopupButton Menu$$$$&#8221;);<br />
			*/<br />
			//menu = new Menu();<br />
			menuXMLL=menuDataXML.children();<br />
			menu.dataProvider = menuXMLL;<br />
			menu.labelField = &#8220;@label&#8221;;<br />
			menu.iconField = &#8220;@icon&#8221;;<br />
			//BindingUtils.bindProperty((this,&#8221;popUp&#8221;,menu<br />
			//this.popUp=menu;</p>
<p>		}<br />
		/*<br />
		private function setViewDate():void<br />
		{</p>
<p>			this.addEventListener(&#8220;itemClick&#8221;,  handleItemClick,false,0,true);<br />
			//Menu(this.popUp).selectedIndex = 0;<br />
				for(var i:int=0; i &lt; this.dataProvider.length;  i++)<br />
				{<br />
						this.label = this.dataProvider[i].@label;<br />
						this.iconField=this.dataProvider[i].@icon; //DropDown Action<br />
						break;</p>
<p>				}<br />
		}<br />
		public function handleItemClick(event:MenuEvent):void<br />
		{</p>
<p>			trace(&quot;PopupButton Menu handle item click $$$$$&quot;);<br />
			var xml:XML = new XML(event.item);<br />
			var str:String;<br />
			switch(String(event.item.@data))<br />
			{<br />
				/*case &quot;New&quot;:trace(&quot;New&quot;);<br />
					str=&quot;msf.foundation.actions.NewMdlObjectAction&quot;;<br />
					//var cl:Class = str as Class;<br />
					//var cf:ClassFactory = new ClassFactory(cl);<br />
					//action = cf.newInstance() as AbstractAction;<br />
					//action.setUiObject(this);<br />
					//menuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, action.handleExecute);<br />
					//a= new NewMdlObjectAction();<br />
					action = new NewMdlObjectAction();<br />
					action.setUiObject(MdlCollectionView);<br />
					action.handleExecute(event);<br />
					//callLater(a.handleExecute, [new Event(&quot;test&quot;)]);<br />
					break;<br />
				case &quot;Play&quot;:trace(&quot;Play&quot;);<br />
					break;*/<br />
			/*}</p>
<p>		}*/<br />
	}<br />
}</p>
<p>============================================</p>
<p>================================================</p>
<p>Can you please tell me what else I will have to do to display the icons?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter deHaan</title>
		<link>http://blog.flexexamples.com/2009/01/20/displaying-icons-in-a-flex-popupbutton-control-redux/comment-page-1/#comment-6672</link>
		<dc:creator>Peter deHaan</dc:creator>
		<pubDate>Thu, 24 Dec 2009 20:58:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2009/01/20/displaying-icons-in-a-flex-popupbutton-control-redux/#comment-6672</guid>
		<description>@Reny Mohan,

How about setting the &lt;code&gt;isPopUp&lt;/code&gt; property to false?

&lt;pre lang=&quot;mxml&quot;&gt;
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;&gt;
    
    &lt;mx:PopUpButton id=&quot;popUpButton&quot;
            label=&quot;Select a control...&quot;
            creationComplete=&quot;popUpButton.open();&quot;&gt;
        &lt;mx:popUp&gt;
            &lt;mx:Panel width=&quot;300&quot; height=&quot;200&quot; id=&quot;pnl&quot; creationComplete=&quot;pnl.isPopUp = false;&quot;&gt;
                &lt;mx:Button label=&quot;I&#039;m a button&quot; /&gt;
                &lt;mx:ControlBar&gt;
                    &lt;mx:Button label=&quot;I&#039;m a button in a control bar&quot; /&gt;
                &lt;/mx:ControlBar&gt;
            &lt;/mx:Panel&gt;
        &lt;/mx:popUp&gt;
    &lt;/mx:PopUpButton&gt;
    
&lt;/mx:Application&gt;
&lt;/pre&gt;

Peter</description>
		<content:encoded><![CDATA[<p>@Reny Mohan,</p>
<p>How about setting the <code>isPopUp</code> property to false?</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:PopUpButton</span> id=<span style="color: #ff0000;">&quot;popUpButton&quot;</span></span>
<span style="color: #000000;">            label=<span style="color: #ff0000;">&quot;Select a control...&quot;</span></span>
<span style="color: #000000;">            creationComplete=<span style="color: #ff0000;">&quot;popUpButton.open();&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:popUp</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Panel</span> width=<span style="color: #ff0000;">&quot;300&quot;</span> height=<span style="color: #ff0000;">&quot;200&quot;</span> id=<span style="color: #ff0000;">&quot;pnl&quot;</span> creationComplete=<span style="color: #ff0000;">&quot;pnl.isPopUp = false;&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> label=<span style="color: #ff0000;">&quot;I'm a button&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ControlBar</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> label=<span style="color: #ff0000;">&quot;I'm a button in a control bar&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ControlBar</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Panel</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:popUp</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:PopUpButton</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reny Mohan</title>
		<link>http://blog.flexexamples.com/2009/01/20/displaying-icons-in-a-flex-popupbutton-control-redux/comment-page-1/#comment-6668</link>
		<dc:creator>Reny Mohan</dc:creator>
		<pubDate>Thu, 24 Dec 2009 10:43:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2009/01/20/displaying-icons-in-a-flex-popupbutton-control-redux/#comment-6668</guid>
		<description>Hi  ,  is  there any better way  to give  popup components  to the popupButton  ..the problem is when  dragging the popup,it seperates  from the popup button...Thanks in advance
regards 

Reny</description>
		<content:encoded><![CDATA[<p>Hi  ,  is  there any better way  to give  popup components  to the popupButton  ..the problem is when  dragging the popup,it seperates  from the popup button&#8230;Thanks in advance<br />
regards </p>
<p>Reny</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://blog.flexexamples.com/2009/01/20/displaying-icons-in-a-flex-popupbutton-control-redux/comment-page-1/#comment-4095</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Fri, 20 Mar 2009 01:08:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2009/01/20/displaying-icons-in-a-flex-popupbutton-control-redux/#comment-4095</guid>
		<description>Is there a way to move the x position of the menu relative to its PopUpButton?

By default, the menu is left aligned with the left edge of the PopUpButton, but my menu has a shadow as part of its borderSkin, so I need to shift the x position of the menu 4 pixels left.

Thanks for your help!</description>
		<content:encoded><![CDATA[<p>Is there a way to move the x position of the menu relative to its PopUpButton?</p>
<p>By default, the menu is left aligned with the left edge of the PopUpButton, but my menu has a shadow as part of its borderSkin, so I need to shift the x position of the menu 4 pixels left.</p>
<p>Thanks for your help!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter deHaan</title>
		<link>http://blog.flexexamples.com/2009/01/20/displaying-icons-in-a-flex-popupbutton-control-redux/comment-page-1/#comment-4094</link>
		<dc:creator>Peter deHaan</dc:creator>
		<pubDate>Fri, 13 Feb 2009 03:12:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2009/01/20/displaying-icons-in-a-flex-popupbutton-control-redux/#comment-4094</guid>
		<description>David Passey,

No reason. The preinitialize event gets run first, but it shouldn&#039;t really matter which event you use (I don&#039;t think -- I&#039;m often wrong).

Peter</description>
		<content:encoded><![CDATA[<p>David Passey,</p>
<p>No reason. The preinitialize event gets run first, but it shouldn&#8217;t really matter which event you use (I don&#8217;t think &#8212; I&#8217;m often wrong).</p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Passey</title>
		<link>http://blog.flexexamples.com/2009/01/20/displaying-icons-in-a-flex-popupbutton-control-redux/comment-page-1/#comment-4096</link>
		<dc:creator>David Passey</dc:creator>
		<pubDate>Thu, 12 Feb 2009 17:26:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2009/01/20/displaying-icons-in-a-flex-popupbutton-control-redux/#comment-4096</guid>
		<description>Good example.  I&#039;m wondering why you use preinitialize instead of initialize in this code?</description>
		<content:encoded><![CDATA[<p>Good example.  I&#8217;m wondering why you use preinitialize instead of initialize in this code?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://blog.flexexamples.com/2009/01/20/displaying-icons-in-a-flex-popupbutton-control-redux/comment-page-1/#comment-4093</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Wed, 28 Jan 2009 16:40:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2009/01/20/displaying-icons-in-a-flex-popupbutton-control-redux/#comment-4093</guid>
		<description>How do you do this, specify icon when the XML list is specified in an ActionScript class?  This class is then specified as the dataProvider via databinding.  When I try this for menus the icon is just not displayed (no errors0 and when I do the same for a PopUpMenuButton I get an error saying that cannot parse value of type Class from text &#039;@icon&#039;.</description>
		<content:encoded><![CDATA[<p>How do you do this, specify icon when the XML list is specified in an ActionScript class?  This class is then specified as the dataProvider via databinding.  When I try this for menus the icon is just not displayed (no errors0 and when I do the same for a PopUpMenuButton I get an error saying that cannot parse value of type Class from text &#8216;@icon&#8217;.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

