<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.1" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Adding icons to the Flex ButtonBar control</title>
	<link>http://blog.flexexamples.com/2008/01/07/adding-icons-to-the-flex-buttonbar-control/</link>
	<description>A bunch of examples for Adobe Flex and ActionScript</description>
	<pubDate>Thu, 08 Jan 2009 13:04:42 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>

	<item>
		<title>By: Tom</title>
		<link>http://blog.flexexamples.com/2008/01/07/adding-icons-to-the-flex-buttonbar-control/#comment-16391</link>
		<author>Tom</author>
		<pubDate>Fri, 24 Oct 2008 14:55:26 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/01/07/adding-icons-to-the-flex-buttonbar-control/#comment-16391</guid>
		<description>Actually, @Embed is like a preprocessor directive (like #include in C). @Embed means open the file, and include it in my SWF file. So you CANT use it at runtime. 

There is a big problem (issue) with icon in flex, because icon must be compiled with the SWF (they not implement loader like image class).

BUT you can find utility class emulating this, and so you can use url for your icon.

Have a look at http://blog.benstucki.net/?p=42</description>
		<content:encoded><![CDATA[<p>Actually, @Embed is like a preprocessor directive (like #include in C). @Embed means open the file, and include it in my SWF file. So you CANT use it at runtime. </p>
<p>There is a big problem (issue) with icon in flex, because icon must be compiled with the SWF (they not implement loader like image class).</p>
<p>BUT you can find utility class emulating this, and so you can use url for your icon.</p>
<p>Have a look at <a href="http://blog.benstucki.net/?p=42" rel="nofollow">http://blog.benstucki.net/?p=42</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: alex</title>
		<link>http://blog.flexexamples.com/2008/01/07/adding-icons-to-the-flex-buttonbar-control/#comment-14193</link>
		<author>alex</author>
		<pubDate>Thu, 17 Jul 2008 10:14:48 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/01/07/adding-icons-to-the-flex-buttonbar-control/#comment-14193</guid>
		<description>i mean: &#38; # 6 4 ; Embed('images/icon8.png')</description>
		<content:encoded><![CDATA[<p>i mean: &amp; # 6 4 ; Embed(&#8217;images/icon8.png&#8217;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: alex</title>
		<link>http://blog.flexexamples.com/2008/01/07/adding-icons-to-the-flex-buttonbar-control/#comment-14192</link>
		<author>alex</author>
		<pubDate>Thu, 17 Jul 2008 10:14:24 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/01/07/adding-icons-to-the-flex-buttonbar-control/#comment-14192</guid>
		<description>what about using &#64;Embed('assets/icons/icon.png') instead</description>
		<content:encoded><![CDATA[<p>what about using &#64;Embed(&#8217;assets/icons/icon.png&#8217;) instead</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jeremie</title>
		<link>http://blog.flexexamples.com/2008/01/07/adding-icons-to-the-flex-buttonbar-control/#comment-11950</link>
		<author>jeremie</author>
		<pubDate>Sat, 12 Apr 2008 10:32:59 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/01/07/adding-icons-to-the-flex-buttonbar-control/#comment-11950</guid>
		<description>Hi dc
Thanks for the reply, but I am not sure to understand what u mean

Here is what I changed:
&lt;pre class="code"&gt;
&#60;toolBarItem&#62;
	&#60;id&#62;toDefaultBtn&#60;/id&#62;
	&#60;state&#62;default&#60;/state&#62;
	&#60;tooltip&#62;Home&#60;/tooltip&#62;
	&#60;icon&#62;@Embed(/"assets/icons/icon.png")&#60;/icon&#62;
&#60;/toolBarItem&#62;
&lt;/pre&gt;

And here is the same error message:
Error #1034: Type Coercion failed: cannot convert "@Embed(/"assets/icons/icon.png")" to Class.

Could u please send me the details of what u got to work please?
Thx</description>
		<content:encoded><![CDATA[<p>Hi dc<br />
Thanks for the reply, but I am not sure to understand what u mean</p>
<p>Here is what I changed:</p>
<pre class="code">
&lt;toolBarItem&gt;
	&lt;id&gt;toDefaultBtn&lt;/id&gt;
	&lt;state&gt;default&lt;/state&gt;
	&lt;tooltip&gt;Home&lt;/tooltip&gt;
	&lt;icon&gt;@Embed(/"assets/icons/icon.png")&lt;/icon&gt;
&lt;/toolBarItem&gt;
</pre>
<p>And here is the same error message:<br />
Error #1034: Type Coercion failed: cannot convert &#8220;@Embed(/&#8221;assets/icons/icon.png&#8221;)&#8221; to Class.</p>
<p>Could u please send me the details of what u got to work please?<br />
Thx</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dc</title>
		<link>http://blog.flexexamples.com/2008/01/07/adding-icons-to-the-flex-buttonbar-control/#comment-11387</link>
		<author>dc</author>
		<pubDate>Wed, 09 Apr 2008 10:48:26 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/01/07/adding-icons-to-the-flex-buttonbar-control/#comment-11387</guid>
		<description>I just got the metadata issue, I had Embed(/'assets/my.gif').
Also, not sure if it is the blog, but make sure it is normal quotes (") rather than smart quotes</description>
		<content:encoded><![CDATA[<p>I just got the metadata issue, I had Embed(/&#8217;assets/my.gif&#8217;).<br />
Also, not sure if it is the blog, but make sure it is normal quotes (&#8221;) rather than smart quotes</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jeremie</title>
		<link>http://blog.flexexamples.com/2008/01/07/adding-icons-to-the-flex-buttonbar-control/#comment-7791</link>
		<author>jeremie</author>
		<pubDate>Sat, 22 Mar 2008 02:55:29 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/01/07/adding-icons-to-the-flex-buttonbar-control/#comment-7791</guid>
		<description>Hi,
Here is a sample of my XML. I have tried several approach, but non of them worked. I put below what I've tried. 

&lt;pre class="code"&gt;
&#60;?xml version="1.0" encoding="UTF-8"?&#62;
&#60;toolBar&#62;
	
	&#60;toolBarItem&#62;
		&#60;id&#62;toDefaultBtn&#60;/id&#62;
		&#60;state&#62;default&#60;/state&#62;
		&#60;tooltip&#62;Home&#60;/tooltip&#62;
		&#60;icon&#62;@Embed("assets/icons/icon.png")&#60;/icon&#62;
	&#60;/toolBarItem&#62;	
	
	&#60;toolBarItem&#62;
		&#60;id&#62;toCustomersBtn&#60;/id&#62;
		&#60;state&#62;customers&#60;/state&#62;
		&#60;tooltip&#62;Customers&#60;/tooltip&#62;
		&#60;icon&#62;{icon1}&#60;/icon&#62;
	&#60;/toolBarItem&#62;
	
	&#60;toolBarItem&#62;
		&#60;id&#62;toStockBtn&#60;/id&#62;
		&#60;state&#62;stock&#60;/state&#62;
		&#60;tooltip&#62;Boutique Stock&#60;/tooltip&#62;
		&#60;icon&#62;icon2&#60;/icon&#62;
	&#60;/toolBarItem&#62;
	
&#60;/toolBar&#62;
&lt;/pre&gt;

Thx for your help!</description>
		<content:encoded><![CDATA[<p>Hi,<br />
Here is a sample of my XML. I have tried several approach, but non of them worked. I put below what I&#8217;ve tried. </p>
<pre class="code">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;toolBar&gt;

	&lt;toolBarItem&gt;
		&lt;id&gt;toDefaultBtn&lt;/id&gt;
		&lt;state&gt;default&lt;/state&gt;
		&lt;tooltip&gt;Home&lt;/tooltip&gt;
		&lt;icon&gt;@Embed("assets/icons/icon.png")&lt;/icon&gt;
	&lt;/toolBarItem&gt;	

	&lt;toolBarItem&gt;
		&lt;id&gt;toCustomersBtn&lt;/id&gt;
		&lt;state&gt;customers&lt;/state&gt;
		&lt;tooltip&gt;Customers&lt;/tooltip&gt;
		&lt;icon&gt;{icon1}&lt;/icon&gt;
	&lt;/toolBarItem&gt;

	&lt;toolBarItem&gt;
		&lt;id&gt;toStockBtn&lt;/id&gt;
		&lt;state&gt;stock&lt;/state&gt;
		&lt;tooltip&gt;Boutique Stock&lt;/tooltip&gt;
		&lt;icon&gt;icon2&lt;/icon&gt;
	&lt;/toolBarItem&gt;

&lt;/toolBar&gt;
</pre>
<p>Thx for your help!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2008/01/07/adding-icons-to-the-flex-buttonbar-control/#comment-7724</link>
		<author>peterd</author>
		<pubDate>Thu, 20 Mar 2008 15:15:29 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/01/07/adding-icons-to-the-flex-buttonbar-control/#comment-7724</guid>
		<description>jeremie,

Good question. What does your XML look like?

Peter</description>
		<content:encoded><![CDATA[<p>jeremie,</p>
<p>Good question. What does your XML look like?</p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jeremie</title>
		<link>http://blog.flexexamples.com/2008/01/07/adding-icons-to-the-flex-buttonbar-control/#comment-7716</link>
		<author>jeremie</author>
		<pubDate>Thu, 20 Mar 2008 14:20:15 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/01/07/adding-icons-to-the-flex-buttonbar-control/#comment-7716</guid>
		<description>Thanks for the very good tutorial,

I have a question. If I use a XML file as data provider and a repeater class to dynamically create buttons, is there a way to add a proper icon to the dynamically created buttons.

Here is my code:
&lt;pre class="code"&gt;
&#60;mx:Repeater id="toolBarRepeater" dataProvider="{toolBarData}"&#62;
&#60;mx:Button styleName="navbutton" name="{toolBarRepeater.currentItem.id}"
    click="setTransition(String(event.currentTarget.getRepeaterItem().state));"
    toolTip="{toolBarRepeater.currentItem.tooltip}"
    icon="HERE I WANT A DYNAMIC ICON"/&#62;
&#60;/mx:Repeater&#62;
&lt;/pre&gt;

I have an icon param in my xml but I alway have an 'Invalid metadata format' error.

Thx!</description>
		<content:encoded><![CDATA[<p>Thanks for the very good tutorial,</p>
<p>I have a question. If I use a XML file as data provider and a repeater class to dynamically create buttons, is there a way to add a proper icon to the dynamically created buttons.</p>
<p>Here is my code:</p>
<pre class="code">
&lt;mx:Repeater id="toolBarRepeater" dataProvider="{toolBarData}"&gt;
&lt;mx:Button styleName="navbutton" name="{toolBarRepeater.currentItem.id}"
    click="setTransition(String(event.currentTarget.getRepeaterItem().state));"
    toolTip="{toolBarRepeater.currentItem.tooltip}"
    icon="HERE I WANT A DYNAMIC ICON"/&gt;
&lt;/mx:Repeater&gt;
</pre>
<p>I have an icon param in my xml but I alway have an &#8216;Invalid metadata format&#8217; error.</p>
<p>Thx!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lili</title>
		<link>http://blog.flexexamples.com/2008/01/07/adding-icons-to-the-flex-buttonbar-control/#comment-6024</link>
		<author>lili</author>
		<pubDate>Sat, 12 Jan 2008 05:56:09 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/01/07/adding-icons-to-the-flex-buttonbar-control/#comment-6024</guid>
		<description>Thank you you example it's give me a lot of help</description>
		<content:encoded><![CDATA[<p>Thank you you example it&#8217;s give me a lot of help</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dormouse</title>
		<link>http://blog.flexexamples.com/2008/01/07/adding-icons-to-the-flex-buttonbar-control/#comment-5903</link>
		<author>dormouse</author>
		<pubDate>Tue, 08 Jan 2008 13:31:00 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/01/07/adding-icons-to-the-flex-buttonbar-control/#comment-5903</guid>
		<description>very good

enjoy</description>
		<content:encoded><![CDATA[<p>very good</p>
<p>enjoy</p>
]]></content:encoded>
	</item>
</channel>
</rss>
