<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flex Examples &#187; buttonWidth</title>
	<atom:link href="http://blog.flexexamples.com/tag/buttonwidth/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Wed, 26 Jan 2011 18:09:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Creating fixed width buttons in a Flex ButtonBar component</title>
		<link>http://blog.flexexamples.com/2007/09/05/creating-fixed-width-buttons-in-a-flex-buttonbar-component/</link>
		<comments>http://blog.flexexamples.com/2007/09/05/creating-fixed-width-buttons-in-a-flex-buttonbar-component/#comments</comments>
		<pubDate>Thu, 06 Sep 2007 03:54:16 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ButtonBar]]></category>
		<category><![CDATA[buttonWidth]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/09/05/creating-fixed-width-buttons-in-a-flex-buttonbar-component/</guid>
		<description><![CDATA[<p>The following example shows how you can create fixed width buttons in a Flex ButtonBar component by setting the buttonWidth style. To revert back to variable width buttons, simply set the buttonWidth style to NaN (not a number).</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_buttonWidth_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2007/09/05/creating-fixed-width-buttons-in-a-flex-buttonbar-component/ --&#62; &#60;mx:Application [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can create fixed width buttons in a Flex ButtonBar component by setting the <code>buttonWidth</code> style. To revert back to variable width buttons, simply set the <code>buttonWidth</code> style to <code>NaN</code> (not a number).</p>
<p>Full code after the jump.</p>
<p><span id="more-157"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_buttonWidth_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/09/05/creating-fixed-width-buttons-in-a-flex-buttonbar-component/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            private function slider_change(evt:Event):void {
                if (checkBox.selected) {
                    buttonBar.setStyle("buttonWidth", slider.value);
                } else {
                    buttonBar.setStyle("buttonWidth", NaN);
                }
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:CheckBox id="checkBox"
                label="fixed width:"
                labelPlacement="left"
                change="slider_change(event)" /&gt;

        &lt;mx:Spacer width="50" /&gt;

        &lt;mx:Label text="buttonWidth:" /&gt;
        &lt;mx:HSlider id="slider"
                enabled="{checkBox.selected}"
                minimum="50"
                maximum="150"
                value="75"
                liveDragging="true"
                snapInterval="5"
                dataTipPrecision="0"
                tickInterval="10"
                change="slider_change(event)" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:ButtonBar id="buttonBar"&gt;
        &lt;mx:dataProvider&gt;
            &lt;mx:Array&gt;
                &lt;mx:Object label="One" /&gt;
                &lt;mx:Object label="Two" /&gt;
                &lt;mx:Object label="Thirteen" /&gt;
            &lt;/mx:Array&gt;
        &lt;/mx:dataProvider&gt;
    &lt;/mx:ButtonBar&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_buttonWidth_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/ButtonBar_buttonWidth_test/bin/main.html" width="100%" height="150"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Creating fixed width buttons in a Flex ButtonBar component on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/09/05/creating-fixed-width-buttons-in-a-flex-buttonbar-component/',contentID: 'post-157',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'buttonWidth',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/09/05/creating-fixed-width-buttons-in-a-flex-buttonbar-component/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

