<?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: Setting the text alignment in a NumericStepper control in Flex</title>
	<link>http://blog.flexexamples.com/2008/05/18/setting-the-text-alignment-in-a-numericstepper-control-in-flex/</link>
	<description>A bunch of examples for Adobe Flex and ActionScript</description>
	<pubDate>Fri, 05 Dec 2008 00:02:04 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>

	<item>
		<title>By: akshay</title>
		<link>http://blog.flexexamples.com/2008/05/18/setting-the-text-alignment-in-a-numericstepper-control-in-flex/#comment-12790</link>
		<author>akshay</author>
		<pubDate>Tue, 20 May 2008 05:53:27 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/05/18/setting-the-text-alignment-in-a-numericstepper-control-in-flex/#comment-12790</guid>
		<description>its of loads of help</description>
		<content:encoded><![CDATA[<p>its of loads of help</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vigil</title>
		<link>http://blog.flexexamples.com/2008/05/18/setting-the-text-alignment-in-a-numericstepper-control-in-flex/#comment-12775</link>
		<author>vigil</author>
		<pubDate>Mon, 19 May 2008 16:16:14 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/05/18/setting-the-text-alignment-in-a-numericstepper-control-in-flex/#comment-12775</guid>
		<description>Thank you very much Peter. It's perfect! :)</description>
		<content:encoded><![CDATA[<p>Thank you very much Peter. It&#8217;s perfect! :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2008/05/18/setting-the-text-alignment-in-a-numericstepper-control-in-flex/#comment-12773</link>
		<author>peterd</author>
		<pubDate>Mon, 19 May 2008 14:37:28 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/05/18/setting-the-text-alignment-in-a-numericstepper-control-in-flex/#comment-12773</guid>
		<description>&lt;a href="http://blog.flexexamples.com/2008/05/18/setting-the-text-alignment-in-a-numericstepper-control-in-flex/#comment-12772" rel="nofollow"&gt;vigil&lt;/a&gt;,

This should do it:
&lt;pre class="code"&gt;
&#60;?xml version="1.0" encoding="utf-8"?&#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.NumericStepperEvent;

            private var nsMask:String = "000";

            private function formatNumber(evt:Event):void {
                var value:String = numericStepper.value.toString();
                value = (nsMask + value).substr(-nsMask.length);
                numericStepper.mx_internal::inputField.text = value;
            }
        ]]&#62;
    &#60;/mx:Script&#62;

    &#60;mx:NumericStepper id="numericStepper"
            minimum="0"
            maximum="255"
            value="3"
            width="100"
            textAlign="center"
            creationComplete="formatNumber(event);"
            change="formatNumber(event);" /&#62;

&#60;/mx:Application&#62;
&lt;/pre&gt;

Peter</description>
		<content:encoded><![CDATA[<p><a href="http://blog.flexexamples.com/2008/05/18/setting-the-text-alignment-in-a-numericstepper-control-in-flex/#comment-12772" rel="nofollow">vigil</a>,</p>
<p>This should do it:</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&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.NumericStepperEvent;

            private var nsMask:String = "000";

            private function formatNumber(evt:Event):void {
                var value:String = numericStepper.value.toString();
                value = (nsMask + value).substr(-nsMask.length);
                numericStepper.mx_internal::inputField.text = value;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:NumericStepper id="numericStepper"
            minimum="0"
            maximum="255"
            value="3"
            width="100"
            textAlign="center"
            creationComplete="formatNumber(event);"
            change="formatNumber(event);" /&gt;

&lt;/mx:Application&gt;
</pre>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vigil</title>
		<link>http://blog.flexexamples.com/2008/05/18/setting-the-text-alignment-in-a-numericstepper-control-in-flex/#comment-12772</link>
		<author>vigil</author>
		<pubDate>Mon, 19 May 2008 13:33:11 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/05/18/setting-the-text-alignment-in-a-numericstepper-control-in-flex/#comment-12772</guid>
		<description>There is an easy way to add leading zeros to the numeric stepper in mxml? [ie. 001, insted of 1]</description>
		<content:encoded><![CDATA[<p>There is an easy way to add leading zeros to the numeric stepper in mxml? [ie. 001, insted of 1]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
