<?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; percentWidth</title>
	<atom:link href="http://blog.flexexamples.com/tag/percentwidth/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 a resizing ToolBar in Flex</title>
		<link>http://blog.flexexamples.com/2008/01/06/creating-a-resizing-toolbar-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/01/06/creating-a-resizing-toolbar-in-flex/#comments</comments>
		<pubDate>Sun, 06 Jan 2008 08:26:27 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Repeater]]></category>
		<category><![CDATA[ToolBar]]></category>
		<category><![CDATA[percentWidth]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/06/creating-a-resizing-toolbar-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can create a toolbar in Flex by using the ToolBar container which automatically wraps and re-lays out its children when the toolbar is resized. According to the documentation in the class file (see [SDK Directory]\frameworks\projects\framework\src\mx\controls\richTextEditorClasses\ToolBar.as):</p> <p> The ToolBar container lays out its children in a single horizontal row. If [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can create a toolbar in Flex by using the ToolBar container which automatically wraps and re-lays out its children when the toolbar is resized. According to the documentation in the class file (see [SDK Directory]\frameworks\projects\framework\src\mx\controls\richTextEditorClasses\ToolBar.as):</p>
<blockquote><p>
The ToolBar container lays out its children in a single horizontal row. If the width of the container is less than the measured width, the children wrap to the next line.<br />
While wrapping, any VRule controls (separators) at the end of a row or the beginning of a row are not drawn.
</p></blockquote>
<p>Full code after the jump.</p>
<p><span id="more-428"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/ToolBar_percentWidth_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/01/06/creating-a-resizing-toolbar-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="top"
        backgroundColor="white"&gt;

    &lt;mx:Array id="images"&gt;
        &lt;mx:Object label="Button" /&gt;
        &lt;mx:Object label="ButtonBar" /&gt;
        &lt;mx:Object label="CheckBox" /&gt;
        &lt;mx:Object label="ColorPicker" /&gt;
        &lt;mx:Object label="ComboBox" /&gt;
        &lt;mx:Object label="DataGrid" /&gt;
        &lt;mx:Object label="DateChooser" /&gt;
        &lt;mx:Object label="DateField" /&gt;
        &lt;mx:Object label="HorizontalList" /&gt;
        &lt;mx:Object label="HRule" /&gt;
        &lt;mx:Object label="HSlider" /&gt;
        &lt;mx:Object label="Image" /&gt;
        &lt;mx:Object label="Label" /&gt;
        &lt;mx:Object label="LinkBar" /&gt;
        &lt;mx:Object label="LinkButton" /&gt;
        &lt;mx:Object label="List" /&gt;
        &lt;mx:Object label="Menu" /&gt;
        &lt;mx:Object label="MenuBar" /&gt;
        &lt;mx:Object label="NumericStepper" /&gt;
        &lt;mx:Object label="ProgressBar" /&gt;
        &lt;mx:Object label="RadioButton" /&gt;
        &lt;mx:Object label="RadioButtonGroup" /&gt;
        &lt;mx:Object label="RichTextEditor" /&gt;
        &lt;mx:Object label="Spacer" /&gt;
        &lt;mx:Object label="SWFLoader" /&gt;
        &lt;mx:Object label="TabBar" /&gt;
        &lt;mx:Object label="Text" /&gt;
        &lt;mx:Object label="TextArea" /&gt;
        &lt;mx:Object label="TextInput" /&gt;
        &lt;mx:Object label="TileList" /&gt;
        &lt;mx:Object label="Tree" /&gt;
        &lt;mx:Object label="VideoDisplay" /&gt;
        &lt;mx:Object label="VRule" /&gt;
        &lt;mx:Object label="VScrollBar" /&gt;
        &lt;mx:Object label="VSlider" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="percentWidth:"&gt;
                &lt;mx:HSlider id="slider"
                        minimum="0"
                        maximum="100"
                        value="35"
                        liveDragging="true"
                        snapInterval="1"
                        tickInterval="10"
                        dataTipPrecision="0" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:VBox id="vBox"
            verticalAlign="middle"
            horizontalAlign="center"
            backgroundColor="black"
            backgroundAlpha="0.1"
            width="100%"
            height="200"&gt;
        &lt;mx:ToolBar id="toolBar"
                 percentWidth="{slider.value}"
                 backgroundColor="haloSilver"
                 minWidth="18"&gt;
            &lt;mx:Repeater id="imgRepeater"
                    dataProvider="{images}"&gt;
                &lt;mx:Image id="img"
                        source="assets/{imgRepeater.currentItem.label}.png"
                        toolTip="{imgRepeater.currentItem.label}" /&gt;
            &lt;/mx:Repeater&gt;
        &lt;/mx:ToolBar&gt;
    &lt;/mx:VBox&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/ToolBar_percentWidth_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/ToolBar_percentWidth_test/bin/main.html" width="100%" height="300"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Creating a resizing ToolBar in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/01/06/creating-a-resizing-toolbar-in-flex/',contentID: 'post-428',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'percentWidth',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/2008/01/06/creating-a-resizing-toolbar-in-flex/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Setting a Flex component or control&#8217;s width to a percentage value</title>
		<link>http://blog.flexexamples.com/2007/09/23/setting-a-flex-component-or-controls-width-to-a-percentage-value/</link>
		<comments>http://blog.flexexamples.com/2007/09/23/setting-a-flex-component-or-controls-width-to-a-percentage-value/#comments</comments>
		<pubDate>Mon, 24 Sep 2007 03:09:16 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Button]]></category>
		<category><![CDATA[percentHeight]]></category>
		<category><![CDATA[percentWidth]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/09/23/setting-a-flex-component-or-controls-width-to-a-percentage-value/</guid>
		<description><![CDATA[<p>The following example shows how you can set a Button control to use percentage-based width and heights in ActionScript by using the [aptly named] percentWidth and percentHeight properties respectively.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Button_percentWidth_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2007/09/23/setting-a-flex-component-or-controls-width-to-a-percentage-value/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Script&#62; &#60;![CDATA[ import mx.events.SliderEvent; private [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set a Button control to use percentage-based width and heights in ActionScript by using the [aptly named] <code>percentWidth</code> and <code>percentHeight</code> properties respectively.</p>
<p>Full code after the jump.</p>
<p><span id="more-189"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Button_percentWidth_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/23/setting-a-flex-component-or-controls-width-to-a-percentage-value/ --&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[
            import mx.events.SliderEvent;

            private function wSlider_change(evt:SliderEvent):void {
                button.percentWidth = evt.value;
                button.label = "w:" + button.width +
                                ", h:" + button.height;
            }

            private function hSlider_change(evt:SliderEvent):void {
                button.percentHeight = evt.value;
                button.label = "w:" + button.width +
                                ", h:" + button.height;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Label text="percentWidth:" /&gt;
        &lt;mx:HSlider id="wSlider"
                liveDragging="true"
                showTrackHighlight="true"
                minimum="10"
                maximum="100"
                change="wSlider_change(event);"
                snapInterval="1"
                tickInterval="10"
                labels="[10%,100%]" /&gt;

        &lt;mx:Spacer width="100%" /&gt;

        &lt;mx:Label text="percentHeight:" /&gt;
        &lt;mx:HSlider id="hSlider"
                liveDragging="true"
                showTrackHighlight="true"
                minimum="10"
                maximum="100"
                change="hSlider_change(event);"
                snapInterval="1"
                tickInterval="10"
                labels="[10%,100%]" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Button id="button" label="Button" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/Button_percentWidth_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/Button_percentWidth_test/bin/main.html" width="100%" height="300"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting a Flex component or control\&#039;s width to a percentage value on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/09/23/setting-a-flex-component-or-controls-width-to-a-percentage-value/',contentID: 'post-189',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'percentHeight,percentWidth',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/23/setting-a-flex-component-or-controls-width-to-a-percentage-value/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

