<?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>franto.com &#187; Flex Tips</title>
	<atom:link href="http://franto.com/category/development/flex/flex-tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://franto.com</link>
	<description></description>
	<lastBuildDate>Tue, 23 Aug 2011 10:29:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Numeric sorting of Flex DataGridColumn</title>
		<link>http://franto.com/numeric-sorting-of-flex-datagridcolumn/</link>
		<comments>http://franto.com/numeric-sorting-of-flex-datagridcolumn/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 12:18:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex Tips]]></category>

		<guid isPermaLink="false">http://franto.com/?p=1123</guid>
		<description><![CDATA[This is quick solution for Flex coders. If you want to sort column in DataGrid, default sorting is sorted by String and not Number. If you have just one numeric column, you can create custom sort function and set sortCompareFunction for given DataGridColumn. If you have more such columns and you dataProvider is ArrayCollection which consists of many object, better solution is override DataGridColumn and implement compareFunction inside this class.]]></description>
			<content:encoded><![CDATA[<div class='series_toc'><h3>Table of contents for flex-tips</h3><ol><li><a href='http://franto.com/problem-with-xml-attributes-in-as3-0/' title='Problem with XML attributes in AS3.0'>Problem with XML attributes in AS3.0</a></li><li><a href='http://franto.com/unable-to-export-swc-oem/' title='Unable to export SWC oem'>Unable to export SWC oem</a></li><li>Numeric sorting of Flex DataGridColumn</li></ol></div> <div class="TweetButton_button" style="float: right; margin-left: 10px;;height:20px;margin-bottom:5px;"><a href="http://twitter.com/share?url=http%3A%2F%2Ffranto.com%2Fnumeric-sorting-of-flex-datagridcolumn%2F&amp;text=Numeric sorting of Flex DataGridColumn&amp;count=vertical&amp;lang=en"><img src="http://franto.com/blog2/wp-content/plugins/tweetbutton-for-wordpress/images/tweet.png" style="border:none" /></a></div>
<p>This is quick example for <strong>Numeric sorting of Flex DataGrid columns</strong>. If you want to sort column in DataGrid, default sorting is sorted by String and not by Number. If you have just one numeric column, you may create custom sort function and set <strong>sortCompareFunction</strong> for given <strong>DataGridColumn</strong>. If you have more such columns and your dataProvider is <strong>ArrayCollection</strong>, which consists of many objects, better solution is override <strong>DataGridColumn</strong> and implement compare function inside this class. Here is class</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package com.<span style="color: #006600;">flexets</span>.<span style="color: #006600;">components</span>.<span style="color: #006600;">dataGridClasses</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">controls</span>.<span style="color: #006600;">dataGridClasses</span>.<span style="color: #006600;">DataGridColumn</span>;
	<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">utils</span>.<span style="color: #006600;">ObjectUtil</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> NumericDataGridColumn <span style="color: #0066CC;">extends</span> DataGridColumn
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const NUMERIC:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;N&quot;</span>;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> NumericDataGridColumn<span style="color: #66cc66;">&#40;</span>columnName:<span style="color: #0066CC;">String</span>=<span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span>columnName<span style="color: #66cc66;">&#41;</span>;
			initCompare<span style="color: #66cc66;">&#40;</span>NUMERIC<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">function</span> initCompare<span style="color: #66cc66;">&#40;</span>numeric:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>numeric == NUMERIC<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				sortCompareFunction = numericCompare;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #808080; font-style: italic;">/**
		* Pull the numbers from the objects and call the implementation. TAKEN FROM mx.collections.SortField
		*/</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> numericCompare<span style="color: #66cc66;">&#40;</span>a:<span style="color: #0066CC;">Object</span>, b:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">int</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> fa:<span style="color: #0066CC;">Number</span>;
			<span style="color: #0066CC;">try</span>
			<span style="color: #66cc66;">&#123;</span>
				fa = dataField == <span style="color: #000000; font-weight: bold;">null</span> ? <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>a<span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>a<span style="color: #66cc66;">&#91;</span>dataField<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #0066CC;">catch</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">error</span>:<span style="color: #0066CC;">Error</span><span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> fb:<span style="color: #0066CC;">Number</span>;
			<span style="color: #0066CC;">try</span>
			<span style="color: #66cc66;">&#123;</span>
				fb = dataField == <span style="color: #000000; font-weight: bold;">null</span> ? <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>b<span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>b<span style="color: #66cc66;">&#91;</span>dataField<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #0066CC;">catch</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">error</span>:<span style="color: #0066CC;">Error</span><span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
			<span style="color: #b1b100;">return</span> ObjectUtil.<span style="color: #006600;">numericCompare</span><span style="color: #66cc66;">&#40;</span>fa, fb<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>and then just use NumericDataGridColumn  in your mxml in DataGrid like this</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:DataGrid</span> id=<span style="color: #ff0000;">&quot;myDG&quot;</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span> height=<span style="color: #ff0000;">&quot;100%&quot;</span> dataProvider=<span style="color: #ff0000;">&quot;{myDataProvider}&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:columns</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:DataGridColumn</span> dataField=<span style="color: #ff0000;">&quot;id&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;dataGridClasses:NumericDataGridColumn</span> dataField=<span style="color: #ff0000;">&quot;order&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:DataGridColumn</span> dataField=<span style="color: #ff0000;">&quot;title&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;dataGridClasses:NumericDataGridColumn</span> dataField=<span style="color: #ff0000;">&quot;price&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:columns</span><span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:DataGrid</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>Enjoy this little Flex tip.</p>
 <div class='series_links'><a href='http://franto.com/unable-to-export-swc-oem/' title='Unable to export SWC oem'>Previous in series</a> </div>]]></content:encoded>
			<wfw:commentRss>http://franto.com/numeric-sorting-of-flex-datagridcolumn/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Unable to export SWC oem</title>
		<link>http://franto.com/unable-to-export-swc-oem/</link>
		<comments>http://franto.com/unable-to-export-swc-oem/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 08:00:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex Tips]]></category>
		<category><![CDATA[Error]]></category>

		<guid isPermaLink="false">http://franto.com/?p=1026</guid>
		<description><![CDATA[I have few times lately this error in Flex Builder and there were at least 2 cases, which cause this error to happen. So maybe it will help you to find your problem. Some file (in my case .flexLibProperties) has SVN conflicts, so you need to resolve conflicts and merge them to solve this &#8220;Unable [...]]]></description>
			<content:encoded><![CDATA[<div class='series_toc'><h3>Table of contents for flex-tips</h3><ol><li><a href='http://franto.com/problem-with-xml-attributes-in-as3-0/' title='Problem with XML attributes in AS3.0'>Problem with XML attributes in AS3.0</a></li><li>Unable to export SWC oem</li><li><a href='http://franto.com/numeric-sorting-of-flex-datagridcolumn/' title='Numeric sorting of Flex DataGridColumn'>Numeric sorting of Flex DataGridColumn</a></li></ol></div> <div class="TweetButton_button" style="float: right; margin-left: 10px;;height:20px;margin-bottom:5px;"><a href="http://twitter.com/share?url=http%3A%2F%2Ffranto.com%2Funable-to-export-swc-oem%2F&amp;text=Unable to export SWC oem&amp;count=vertical&amp;lang=en&amp;related=Error,Flex,Flex+Tips"><img src="http://franto.com/blog2/wp-content/plugins/tweetbutton-for-wordpress/images/tweet.png" style="border:none" /></a></div>
<p>I have few times lately this error in Flex Builder and there were at least 2 cases, which cause this error to happen. So maybe it will help you to find your problem.</p>
<ul>
<li>Some file (in my case .flexLibProperties) has SVN conflicts, so you need to resolve conflicts and merge them to solve this &#8220;<strong>Unable to export SWC oem</strong>&#8221; error</li>
<li>In your library project there are some assets, which are not checked in project Properties/Flex Library Build Path/Assets Tab</li>
</ul>
<p>If you know about other case, which can cause &#8220;<strong>Unable to export SWC oem</strong>&#8221; error, please let me know in comments and I will add it here to help other people with their development. Thank you</p>
 <div class='series_links'><a href='http://franto.com/problem-with-xml-attributes-in-as3-0/' title='Problem with XML attributes in AS3.0'>Previous in series</a> <a href='http://franto.com/numeric-sorting-of-flex-datagridcolumn/' title='Numeric sorting of Flex DataGridColumn'>Next in series</a></div>]]></content:encoded>
			<wfw:commentRss>http://franto.com/unable-to-export-swc-oem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problem with XML attributes in AS3.0</title>
		<link>http://franto.com/problem-with-xml-attributes-in-as3-0/</link>
		<comments>http://franto.com/problem-with-xml-attributes-in-as3-0/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 15:22:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash Tips & Tricks]]></category>
		<category><![CDATA[Flex Tips]]></category>

		<guid isPermaLink="false">http://franto.com/?p=977</guid>
		<description><![CDATA[I've found today some small problem with setting <strong>XML attribute</strong> for my current application. I'm generating HTML source code via XML, because both are tags languages and I have found this nice problem. Imagine you have DIV tag with class attribute set like this:]]></description>
			<content:encoded><![CDATA[<div class='series_toc'><h3>Table of contents for flex-tips</h3><ol><li>Problem with XML attributes in AS3.0</li><li><a href='http://franto.com/unable-to-export-swc-oem/' title='Unable to export SWC oem'>Unable to export SWC oem</a></li><li><a href='http://franto.com/numeric-sorting-of-flex-datagridcolumn/' title='Numeric sorting of Flex DataGridColumn'>Numeric sorting of Flex DataGridColumn</a></li></ol></div> <div class="TweetButton_button" style="float: right; margin-left: 10px;;height:20px;margin-bottom:5px;"><a href="http://twitter.com/share?url=http%3A%2F%2Ffranto.com%2Fproblem-with-xml-attributes-in-as3-0%2F&amp;text=Problem with XML attributes in AS3.0&amp;count=vertical&amp;lang=en"><img src="http://franto.com/blog2/wp-content/plugins/tweetbutton-for-wordpress/images/tweet.png" style="border:none" /></a></div>
<p>I&#8217;ve found today some small problem with setting <strong>XML attribute</strong> for my current application. I&#8217;m generating HTML source code via XML, because both are tags languages and I have found this nice problem. Imagine you have DIV tag with class attribute set like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div class=&quot;myClass&quot;&gt;test&lt;/div&gt;</pre></div></div>

<p>So in ActionScript 3 you can create it via XML in this way</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> divXML<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">XML</span> = <span style="color: #000000; font-weight: bold;">&lt;</span>div<span style="color: #000000; font-weight: bold;">&gt;</span>test<span style="color: #000000; font-weight: bold;">&lt;/</span>test<span style="color: #000000; font-weight: bold;">&gt;</span>;
divXML.@<span style="color: #9900cc; font-weight: bold;">class</span> = <span style="color: #990000;">&quot;myClass&quot;</span>;</pre></div></div>

<p>All seems ok and trivial, but Flex Builder has problem to compile second line. It seems that @class is reserved word, because I can change to other attribute name and it works. But luckily there are different ways how to set XML attribute for XML node.  I&#8217;ve fixed it in this way</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> divXML<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">XML</span> = <span style="color: #000000; font-weight: bold;">&lt;</span>div<span style="color: #000000; font-weight: bold;">&gt;</span>test<span style="color: #000000; font-weight: bold;">&lt;/</span>test<span style="color: #000000; font-weight: bold;">&gt;</span>;
divXML.@<span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;class&quot;</span><span style="color: #000000;">&#93;</span> = <span style="color: #990000;">&quot;myClass&quot;</span>;</pre></div></div>

<p>What is your preffered  way to set XML attributes?</p>
 <div class='series_links'> <a href='http://franto.com/unable-to-export-swc-oem/' title='Unable to export SWC oem'>Next in series</a></div>]]></content:encoded>
			<wfw:commentRss>http://franto.com/problem-with-xml-attributes-in-as3-0/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>AS3 Conditional Breakpoint &#8211; enterDebugger()</title>
		<link>http://franto.com/as3-conditional-breakpoint-enterdebugger/</link>
		<comments>http://franto.com/as3-conditional-breakpoint-enterdebugger/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 10:41:47 +0000</pubDate>
		<dc:creator>Franto</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex Tips]]></category>
		<category><![CDATA[AS3 Tip]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex Tip]]></category>

		<guid isPermaLink="false">http://www.franto.com/?p=922</guid>
		<description><![CDATA[I have to confess I didn't know about great function enterDebugger() in flash.debugger package. If you ever want to have conditional breakpoint you can do it programatically. Just add this statement to you code and debuger will stop as it there would be normal breakpoint. So you can use it in IF statement and call it just when some conditions are met. I think I will use this function a lot from now on :)]]></description>
			<content:encoded><![CDATA[<div class='series_toc'><h3>Table of contents for flex-tips</h3><ol><li><a href='http://franto.com/flextips/' title='FlexTips'>FlexTips</a></li><li><a href='http://franto.com/flextips-mxtext-vs-mxtextarea/' title='FlexTip: mx:Text vs. mx:TextArea'>FlexTip: mx:Text vs. mx:TextArea</a></li><li><a href='http://franto.com/flextips-xmlsocket-connect-after-disconnect-from-server/' title='FlexTip: XMLSocket connect() after disconnect from server'>FlexTip: XMLSocket connect() after disconnect from server</a></li><li><a href='http://franto.com/flextips-problem-with-masks-and-scalable-flash/' title='FlexTip: Problem with masks and scalable Flash'>FlexTip: Problem with masks and scalable Flash</a></li><li><a href='http://franto.com/flextips-how-to-add-bitmap-to-uicomponent/' title='FlexTips: How to add Bitmap to UIComponent'>FlexTips: How to add Bitmap to UIComponent</a></li><li><a href='http://franto.com/flextips-stop-displaying-focus/' title='FlexTip &#8211; Stop displaying Focus'>FlexTip &#8211; Stop displaying Focus</a></li><li><a href='http://franto.com/preventing-checkbox-selection-with-keyspace/' title='FlexTip: Preventing CheckBox selection with Key.SPACE'>FlexTip: Preventing CheckBox selection with Key.SPACE</a></li><li><a href='http://franto.com/flextip-wordwrap-for-mxtext/' title='FlexTip: WordWrap for mx:Text'>FlexTip: WordWrap for mx:Text</a></li><li><a href='http://franto.com/add-thumbs-to-mxslider-programatically/' title='FlexTip: Add Thumbs to Mx:Slider programatically'>FlexTip: Add Thumbs to Mx:Slider programatically</a></li><li>AS3 Conditional Breakpoint &#8211; enterDebugger()</li></ol></div> <div class="TweetButton_button" style="float: right; margin-left: 10px;;height:20px;margin-bottom:5px;"><a href="http://twitter.com/share?url=http%3A%2F%2Ffranto.com%2Fas3-conditional-breakpoint-enterdebugger%2F&amp;text=AS3 Conditional Breakpoint &#8211; enterDebugger()&amp;count=vertical&amp;lang=en&amp;related=AS3+Tip,Flex,Flex+Tip"><img src="http://franto.com/blog2/wp-content/plugins/tweetbutton-for-wordpress/images/tweet.png" style="border:none" /></a></div>
<p>I have to confess I didn&#8217;t know about great function enterDebugger() in flash.debugger package. If you ever want to have conditional breakpoint you can do it programatically. Just add this statement to your code and debuger will stop as it there would be normal breakpoint. So you can use it in IF statement and call it just when some conditions are met. I think I will use this function a lot from now on <img src='http://franto.com/blog2/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Enjoy</p>
 <div class='series_links'><a href='http://franto.com/add-thumbs-to-mxslider-programatically/' title='FlexTip: Add Thumbs to Mx:Slider programatically'>Previous in series</a> </div>]]></content:encoded>
			<wfw:commentRss>http://franto.com/as3-conditional-breakpoint-enterdebugger/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>FlexTip: Add Thumbs to Mx:Slider programatically</title>
		<link>http://franto.com/add-thumbs-to-mxslider-programatically/</link>
		<comments>http://franto.com/add-thumbs-to-mxslider-programatically/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 12:16:07 +0000</pubDate>
		<dc:creator>Franto</dc:creator>
				<category><![CDATA[Flex Tips]]></category>
		<category><![CDATA[Flexets]]></category>
		<category><![CDATA[Component]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.franto.com/?p=673</guid>
		<description><![CDATA[I have some new Flex Tip for you. Maybe you have found it already if you have tried add new thumbs to Mx:Slider (HSlider, VSlider) programatically. There can be various &#8220;small&#8221; problems. Or maybe there is just another way What I&#8217;ve tried is increase thumbCount property and add new value to values property. But there [...]]]></description>
			<content:encoded><![CDATA[<div class='series_toc'><h3>Table of contents for flex-tips</h3><ol><li><a href='http://franto.com/flextips/' title='FlexTips'>FlexTips</a></li><li><a href='http://franto.com/flextips-mxtext-vs-mxtextarea/' title='FlexTip: mx:Text vs. mx:TextArea'>FlexTip: mx:Text vs. mx:TextArea</a></li><li><a href='http://franto.com/flextips-xmlsocket-connect-after-disconnect-from-server/' title='FlexTip: XMLSocket connect() after disconnect from server'>FlexTip: XMLSocket connect() after disconnect from server</a></li><li><a href='http://franto.com/flextips-problem-with-masks-and-scalable-flash/' title='FlexTip: Problem with masks and scalable Flash'>FlexTip: Problem with masks and scalable Flash</a></li><li><a href='http://franto.com/flextips-how-to-add-bitmap-to-uicomponent/' title='FlexTips: How to add Bitmap to UIComponent'>FlexTips: How to add Bitmap to UIComponent</a></li><li><a href='http://franto.com/flextips-stop-displaying-focus/' title='FlexTip &#8211; Stop displaying Focus'>FlexTip &#8211; Stop displaying Focus</a></li><li><a href='http://franto.com/preventing-checkbox-selection-with-keyspace/' title='FlexTip: Preventing CheckBox selection with Key.SPACE'>FlexTip: Preventing CheckBox selection with Key.SPACE</a></li><li><a href='http://franto.com/flextip-wordwrap-for-mxtext/' title='FlexTip: WordWrap for mx:Text'>FlexTip: WordWrap for mx:Text</a></li><li>FlexTip: Add Thumbs to Mx:Slider programatically</li><li><a href='http://franto.com/as3-conditional-breakpoint-enterdebugger/' title='AS3 Conditional Breakpoint &#8211; enterDebugger()'>AS3 Conditional Breakpoint &#8211; enterDebugger()</a></li></ol></div> <div class="TweetButton_button" style="float: right; margin-left: 10px;;height:20px;margin-bottom:5px;"><a href="http://twitter.com/share?url=http%3A%2F%2Ffranto.com%2Fadd-thumbs-to-mxslider-programatically%2F&amp;text=FlexTip: Add Thumbs to Mx:Slider programatically&amp;count=vertical&amp;lang=en&amp;related=Component,Flex,Flex+Tips"><img src="http://franto.com/blog2/wp-content/plugins/tweetbutton-for-wordpress/images/tweet.png" style="border:none" /></a></div>
<p>I have some new Flex Tip for you. Maybe you have found it already if you have tried add new thumbs to Mx:Slider (HSlider, VSlider) programatically. There can be various &#8220;small&#8221; problems. Or maybe there is just another way <img src='http://franto.com/blog2/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>What I&#8217;ve tried is increase <strong>thumbCount</strong> property and add new value to <strong>values </strong>property. But there can be problems, if you did not set <strong>snapInterval</strong> property or how you insert new value.</p>
<p>I have created examples with 3 different ways of adding new thumbs to the horizontal slider. There can be more, but I want to show you just these 3 different way of how to do it.</p>
<p>In all examples sliders starting value as follows:</p>
<ul>
<li>minimum = 0</li>
<li>maximum = 0</li>
<li>thumbCount = 2</li>
<li>values = [0,1]</li>
</ul>
<p>I&#8217;m catching MouseEvent.CLICK event on these sliders, and add new thumb. After click you can check last added value, and values property of each slider for you control, what&#8217;s inside. Let&#8217;s try example and after I will explain difference in these 3 different ways fo adding new thumb to slider.</p>
<p><object id="SliderTest" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="600" height="450" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="quality" value="high" /><param name="bgcolor" value="#222222" /><param name="allowScriptAccess" value="sameDomain" /><param name="src" value="http://www.franto.com/blog2/wp-content/uploads/examples/slidertest/SliderTest.swf" /><param name="name" value="SliderTest" /><param name="align" value="middle" /><embed id="SliderTest" type="application/x-shockwave-flash" width="600" height="450" src="http://www.franto.com/blog2/wp-content/uploads/examples/slidertest/SliderTest.swf" align="middle" name="SliderTest" allowscriptaccess="sameDomain" bgcolor="#222222" quality="high"></embed></object></p>
<p>The first example I&#8217;m adding new value to the values property, which is Array by simple slider.values.push(newValue). Problem is that, when you push value e.g. 0.5 to array [0,1], values will be [0,1,0.5] it&#8217;s not sorted (slider has not sorted it by itself). It&#8217;s interesting how slider recompute it&#8217;s values. Just try it in example</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> handleAddWrongPoint<span style="color: #000000;">&#40;</span>e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> newValue<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = idWrongSlider.minimum <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">localX</span> <span style="color: #000000; font-weight: bold;">/</span> idWrongSlider.<span style="color: #004993;">width</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">&#40;</span>idWrongSlider.maximum <span style="color: #000000; font-weight: bold;">-</span> idWrongSlider.minimum<span style="color: #000000;">&#41;</span>;
	newValue = <span style="color: #004993;">int</span><span style="color: #000000;">&#40;</span>newValue <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000; font-weight:bold;">100</span>;
	<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight: bold;">!</span><span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span> <span style="color: #0033ff; font-weight: bold;">is</span> SliderThumb<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		latestWrong = newValue;
		idWrongSlider.thumbCount<span style="color: #000000; font-weight: bold;">++</span>;
		idWrongSlider.values.<span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>newValue<span style="color: #000000;">&#41;</span>;
		idWrongSlider.invalidateProperties<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">'Wrong: '</span> <span style="color: #000000; font-weight: bold;">+</span> e.<span style="color: #004993;">localX</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #990000;">&quot; , new: &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> newValue <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #990000;">&quot; values: &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> idWrongSlider.values<span style="color: #000000;">&#41;</span>;
&nbsp;
		update<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>In second example there is no snapInterval set, and it seems, that causes more interesting problems. Values are now greater than maximum (1), try add few thumbs by clicking on 2nd slider and you can end up with such values property [0,1,2,3,4,5,6,7,0.6]. Really don&#8217;t why <img src='http://franto.com/blog2/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> handleAddWrongPoint2<span style="color: #000000;">&#40;</span>e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> newValue<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = idWrongSlider2.minimum <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">localX</span> <span style="color: #000000; font-weight: bold;">/</span> idWrongSlider2.<span style="color: #004993;">width</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">&#40;</span>idWrongSlider2.maximum <span style="color: #000000; font-weight: bold;">-</span> idWrongSlider2.minimum<span style="color: #000000;">&#41;</span>;
	newValue = <span style="color: #004993;">int</span><span style="color: #000000;">&#40;</span>newValue <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000; font-weight:bold;">100</span>;
	<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight: bold;">!</span><span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span> <span style="color: #0033ff; font-weight: bold;">is</span> SliderThumb<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		latestWrong2 = newValue;
		idWrongSlider2.thumbCount<span style="color: #000000; font-weight: bold;">++</span>;
		idWrongSlider2.values.<span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>newValue<span style="color: #000000;">&#41;</span>;
		idWrongSlider2.invalidateProperties<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">'Wrong: '</span> <span style="color: #000000; font-weight: bold;">+</span> e.<span style="color: #004993;">localX</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #990000;">&quot; , new: &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> newValue <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #990000;">&quot; values: &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> idWrongSlider2.values<span style="color: #000000;">&#41;</span>;
&nbsp;
		update<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>In 3rd examples all is ok, because I&#8217;ve set snapInterval property to 0.01 and I&#8217;m adding new values correctly sorted</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> handleAddCorrectPoint<span style="color: #000000;">&#40;</span>e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #6699cc; font-weight: bold;">var</span> newValue<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = idCorrectSlider.minimum <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">localX</span> <span style="color: #000000; font-weight: bold;">/</span> idCorrectSlider.<span style="color: #004993;">width</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">&#40;</span>idCorrectSlider.maximum <span style="color: #000000; font-weight: bold;">-</span> idCorrectSlider.minimum<span style="color: #000000;">&#41;</span>;
    newValue = <span style="color: #004993;">int</span><span style="color: #000000;">&#40;</span>newValue <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000; font-weight:bold;">100</span>;
    <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight: bold;">!</span><span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span> <span style="color: #0033ff; font-weight: bold;">is</span> SliderThumb<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        latestCorrect = newValue;
        idCorrectSlider.thumbCount<span style="color: #000000; font-weight: bold;">++</span>;
        <span style="color: #6699cc; font-weight: bold;">var</span> arr<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span> = idCorrectSlider.values;
        arr.<span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>newValue<span style="color: #000000;">&#41;</span>;
        idCorrectSlider.values = arr.<span style="color: #004993;">sort</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
        idCorrectSlider.invalidateProperties<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
        <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">'Correct: '</span> <span style="color: #000000; font-weight: bold;">+</span> e.<span style="color: #004993;">localX</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #990000;">&quot; , new: &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> newValue <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #990000;">&quot; values: &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> idCorrectSlider.values<span style="color: #000000;">&#41;</span>;
        update<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Full source to this examples is included in <strong>Download Section</strong> (you will see it just as subscribed member) of our <strong><a href="http://www.flexets.com/forum-info/coaching-forum">Coaching Program</a> <a href="http://www.flexets.com/forum/">Forum</a></strong> on <a href="http://www.flexets.com">Flexets.com</a> (My own company).</p>
 <div class='series_links'><a href='http://franto.com/flextip-wordwrap-for-mxtext/' title='FlexTip: WordWrap for mx:Text'>Previous in series</a> <a href='http://franto.com/as3-conditional-breakpoint-enterdebugger/' title='AS3 Conditional Breakpoint &#8211; enterDebugger()'>Next in series</a></div>]]></content:encoded>
			<wfw:commentRss>http://franto.com/add-thumbs-to-mxslider-programatically/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>FlexTip: WordWrap for mx:Text</title>
		<link>http://franto.com/flextip-wordwrap-for-mxtext/</link>
		<comments>http://franto.com/flextip-wordwrap-for-mxtext/#comments</comments>
		<pubDate>Thu, 28 Aug 2008 09:57:09 +0000</pubDate>
		<dc:creator>Franto</dc:creator>
				<category><![CDATA[Flex Tips]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Tip]]></category>

		<guid isPermaLink="false">http://www.franto.com/?p=534</guid>
		<description><![CDATA[Maybe it is easy, maybe not, but I do not think it&#8217;s straitforward and logical. If you want to set word wrapping for mx:Text you have to set width. If you did not do this, whole text will be in 1 row and not whole text can be visible. So just set width to fix [...]]]></description>
			<content:encoded><![CDATA[<div class='series_toc'><h3>Table of contents for flex-tips</h3><ol><li><a href='http://franto.com/flextips/' title='FlexTips'>FlexTips</a></li><li><a href='http://franto.com/flextips-mxtext-vs-mxtextarea/' title='FlexTip: mx:Text vs. mx:TextArea'>FlexTip: mx:Text vs. mx:TextArea</a></li><li><a href='http://franto.com/flextips-xmlsocket-connect-after-disconnect-from-server/' title='FlexTip: XMLSocket connect() after disconnect from server'>FlexTip: XMLSocket connect() after disconnect from server</a></li><li><a href='http://franto.com/flextips-problem-with-masks-and-scalable-flash/' title='FlexTip: Problem with masks and scalable Flash'>FlexTip: Problem with masks and scalable Flash</a></li><li><a href='http://franto.com/flextips-how-to-add-bitmap-to-uicomponent/' title='FlexTips: How to add Bitmap to UIComponent'>FlexTips: How to add Bitmap to UIComponent</a></li><li><a href='http://franto.com/flextips-stop-displaying-focus/' title='FlexTip &#8211; Stop displaying Focus'>FlexTip &#8211; Stop displaying Focus</a></li><li><a href='http://franto.com/preventing-checkbox-selection-with-keyspace/' title='FlexTip: Preventing CheckBox selection with Key.SPACE'>FlexTip: Preventing CheckBox selection with Key.SPACE</a></li><li>FlexTip: WordWrap for mx:Text</li><li><a href='http://franto.com/add-thumbs-to-mxslider-programatically/' title='FlexTip: Add Thumbs to Mx:Slider programatically'>FlexTip: Add Thumbs to Mx:Slider programatically</a></li><li><a href='http://franto.com/as3-conditional-breakpoint-enterdebugger/' title='AS3 Conditional Breakpoint &#8211; enterDebugger()'>AS3 Conditional Breakpoint &#8211; enterDebugger()</a></li></ol></div> <div class="TweetButton_button" style="float: right; margin-left: 10px;;height:20px;margin-bottom:5px;"><a href="http://twitter.com/share?url=http%3A%2F%2Ffranto.com%2Fflextip-wordwrap-for-mxtext%2F&amp;text=FlexTip: WordWrap for mx:Text&amp;count=vertical&amp;lang=en&amp;related=Flex,Tip"><img src="http://franto.com/blog2/wp-content/plugins/tweetbutton-for-wordpress/images/tweet.png" style="border:none" /></a></div>
<p>Maybe it is easy, maybe not, but I do not think it&#8217;s straitforward and logical. If you want to set word wrapping for mx:Text you have to set width. If you did not do this, whole text will be in 1 row and not whole text can be visible. So  just set width to fix value or percentage value to use word wrapping feature.</p>
<p>Why I don&#8217;t think that it&#8217;s not logical? Because when you did not set width to mx:Text it&#8217;s in 1 row, but just resize app, and now it&#8217;s wordwrapped. So it seems it&#8217;s problem only in initialization phase. I think it should work same in all ocassions. That&#8217;s just my 2 cents</p>
 <div class='series_links'><a href='http://franto.com/preventing-checkbox-selection-with-keyspace/' title='FlexTip: Preventing CheckBox selection with Key.SPACE'>Previous in series</a> <a href='http://franto.com/add-thumbs-to-mxslider-programatically/' title='FlexTip: Add Thumbs to Mx:Slider programatically'>Next in series</a></div>]]></content:encoded>
			<wfw:commentRss>http://franto.com/flextip-wordwrap-for-mxtext/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FlexTip: Preventing CheckBox selection with Key.SPACE</title>
		<link>http://franto.com/preventing-checkbox-selection-with-keyspace/</link>
		<comments>http://franto.com/preventing-checkbox-selection-with-keyspace/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 08:51:31 +0000</pubDate>
		<dc:creator>Franto</dc:creator>
				<category><![CDATA[Flex Tips]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Tip]]></category>

		<guid isPermaLink="false">http://www.franto.com/?p=518</guid>
		<description><![CDATA[This is quick Flex Tip. If you do not need or do not want change CheckBox selection with space key, you can set mouseFocusEnabled to false. &#160; If you know about any other solutions, let us know.]]></description>
			<content:encoded><![CDATA[<div class='series_toc'><h3>Table of contents for flex-tips</h3><ol><li><a href='http://franto.com/flextips/' title='FlexTips'>FlexTips</a></li><li><a href='http://franto.com/flextips-mxtext-vs-mxtextarea/' title='FlexTip: mx:Text vs. mx:TextArea'>FlexTip: mx:Text vs. mx:TextArea</a></li><li><a href='http://franto.com/flextips-xmlsocket-connect-after-disconnect-from-server/' title='FlexTip: XMLSocket connect() after disconnect from server'>FlexTip: XMLSocket connect() after disconnect from server</a></li><li><a href='http://franto.com/flextips-problem-with-masks-and-scalable-flash/' title='FlexTip: Problem with masks and scalable Flash'>FlexTip: Problem with masks and scalable Flash</a></li><li><a href='http://franto.com/flextips-how-to-add-bitmap-to-uicomponent/' title='FlexTips: How to add Bitmap to UIComponent'>FlexTips: How to add Bitmap to UIComponent</a></li><li><a href='http://franto.com/flextips-stop-displaying-focus/' title='FlexTip &#8211; Stop displaying Focus'>FlexTip &#8211; Stop displaying Focus</a></li><li>FlexTip: Preventing CheckBox selection with Key.SPACE</li><li><a href='http://franto.com/flextip-wordwrap-for-mxtext/' title='FlexTip: WordWrap for mx:Text'>FlexTip: WordWrap for mx:Text</a></li><li><a href='http://franto.com/add-thumbs-to-mxslider-programatically/' title='FlexTip: Add Thumbs to Mx:Slider programatically'>FlexTip: Add Thumbs to Mx:Slider programatically</a></li><li><a href='http://franto.com/as3-conditional-breakpoint-enterdebugger/' title='AS3 Conditional Breakpoint &#8211; enterDebugger()'>AS3 Conditional Breakpoint &#8211; enterDebugger()</a></li></ol></div> <div class="TweetButton_button" style="float: right; margin-left: 10px;;height:20px;margin-bottom:5px;"><a href="http://twitter.com/share?url=http%3A%2F%2Ffranto.com%2Fpreventing-checkbox-selection-with-keyspace%2F&amp;text=FlexTip: Preventing CheckBox selection with Key.SPACE&amp;count=vertical&amp;lang=en&amp;related=Flex,Flex+Tips,Tip"><img src="http://franto.com/blog2/wp-content/plugins/tweetbutton-for-wordpress/images/tweet.png" style="border:none" /></a></div>
<p>This is quick Flex Tip. If you do not need or do not want change CheckBox selection with space key, you can set mouseFocusEnabled to false.</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;">&nbsp;</pre></div></div>

<p>If you know about any other solutions, let us know.</p>
 <div class='series_links'><a href='http://franto.com/flextips-stop-displaying-focus/' title='FlexTip &#8211; Stop displaying Focus'>Previous in series</a> <a href='http://franto.com/flextip-wordwrap-for-mxtext/' title='FlexTip: WordWrap for mx:Text'>Next in series</a></div>]]></content:encoded>
			<wfw:commentRss>http://franto.com/preventing-checkbox-selection-with-keyspace/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>FlexTip &#8211; Stop displaying Focus</title>
		<link>http://franto.com/flextips-stop-displaying-focus/</link>
		<comments>http://franto.com/flextips-stop-displaying-focus/#comments</comments>
		<pubDate>Thu, 29 May 2008 13:45:47 +0000</pubDate>
		<dc:creator>Franto</dc:creator>
				<category><![CDATA[Flex Tips]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.franto.com/blog2/flex-tip-stop-displaying-focus</guid>
		<description><![CDATA[Here is quick Flex Tip. If you don&#8217;t want to display focus rectangle on pressing TAB key, you should use focusEnabled = false; It&#8217;s quick solution for 1 component, but if you want disable focus for all components in your application just use focusManager.deactivate(); That&#8217;s all, hope it helps to anyone&#8230; New: Thanks to Marc [...]]]></description>
			<content:encoded><![CDATA[<div class='series_toc'><h3>Table of contents for flex-tips</h3><ol><li><a href='http://franto.com/flextips/' title='FlexTips'>FlexTips</a></li><li><a href='http://franto.com/flextips-mxtext-vs-mxtextarea/' title='FlexTip: mx:Text vs. mx:TextArea'>FlexTip: mx:Text vs. mx:TextArea</a></li><li><a href='http://franto.com/flextips-xmlsocket-connect-after-disconnect-from-server/' title='FlexTip: XMLSocket connect() after disconnect from server'>FlexTip: XMLSocket connect() after disconnect from server</a></li><li><a href='http://franto.com/flextips-problem-with-masks-and-scalable-flash/' title='FlexTip: Problem with masks and scalable Flash'>FlexTip: Problem with masks and scalable Flash</a></li><li><a href='http://franto.com/flextips-how-to-add-bitmap-to-uicomponent/' title='FlexTips: How to add Bitmap to UIComponent'>FlexTips: How to add Bitmap to UIComponent</a></li><li>FlexTip &#8211; Stop displaying Focus</li><li><a href='http://franto.com/preventing-checkbox-selection-with-keyspace/' title='FlexTip: Preventing CheckBox selection with Key.SPACE'>FlexTip: Preventing CheckBox selection with Key.SPACE</a></li><li><a href='http://franto.com/flextip-wordwrap-for-mxtext/' title='FlexTip: WordWrap for mx:Text'>FlexTip: WordWrap for mx:Text</a></li><li><a href='http://franto.com/add-thumbs-to-mxslider-programatically/' title='FlexTip: Add Thumbs to Mx:Slider programatically'>FlexTip: Add Thumbs to Mx:Slider programatically</a></li><li><a href='http://franto.com/as3-conditional-breakpoint-enterdebugger/' title='AS3 Conditional Breakpoint &#8211; enterDebugger()'>AS3 Conditional Breakpoint &#8211; enterDebugger()</a></li></ol></div> <div class="TweetButton_button" style="float: right; margin-left: 10px;;height:20px;margin-bottom:5px;"><a href="http://twitter.com/share?url=http%3A%2F%2Ffranto.com%2Fflextips-stop-displaying-focus%2F&amp;text=FlexTip &#8211; Stop displaying Focus&amp;count=vertical&amp;lang=en&amp;related=Flex,Flex+Tips"><img src="http://franto.com/blog2/wp-content/plugins/tweetbutton-for-wordpress/images/tweet.png" style="border:none" /></a></div>
<p>Here is quick Flex Tip. If you don&#8217;t want to display focus rectangle on pressing TAB key, you should use <strong><a href="http://livedocs.adobe.com/flex/201/langref/mx/core/UIComponent.html#focusEnabled">focusEnabled = false</a></strong>;<br />
It&#8217;s quick solution for 1 component, but if you want disable focus for all components in your application just use <strong><a href="http://livedocs.adobe.com/flex/201/langref/mx/managers/FocusManager.html#deactivate()">focusManager.deactivate();</a></strong></p>
<p>That&#8217;s all, hope it helps to anyone&#8230;</p>
<div style="position:relative;background:#550000;border:#aa0000 solid 3px;padding:10px 5px 5px 10px;color:#ffffff"><strong>New:</strong> Thanks to <strong>Marc Hughes</strong> for pointing this out:</p>
<p>Instead of <strong><a href="http://livedocs.adobe.com/flex/201/langref/mx/managers/FocusManager.html#deactivate()">focusManager.deactivate();</a></strong> use <strong><a href="http://livedocs.adobe.com/flex/201/langref/mx/managers/FocusManager.html#showFocusIndicator()">focusManager.showFocusIndicator=false;</a></strong></div>
 <div class='series_links'><a href='http://franto.com/flextips-how-to-add-bitmap-to-uicomponent/' title='FlexTips: How to add Bitmap to UIComponent'>Previous in series</a> <a href='http://franto.com/preventing-checkbox-selection-with-keyspace/' title='FlexTip: Preventing CheckBox selection with Key.SPACE'>Next in series</a></div>]]></content:encoded>
			<wfw:commentRss>http://franto.com/flextips-stop-displaying-focus/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>FlexTips: How to add Bitmap to UIComponent</title>
		<link>http://franto.com/flextips-how-to-add-bitmap-to-uicomponent/</link>
		<comments>http://franto.com/flextips-how-to-add-bitmap-to-uicomponent/#comments</comments>
		<pubDate>Sun, 29 Jul 2007 14:12:30 +0000</pubDate>
		<dc:creator>Franto</dc:creator>
				<category><![CDATA[Flex Tips]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.franto.com/blog2/flextips-how-to-add-bitmap-to-uicomponent</guid>
		<description><![CDATA[I didn&#8217;t know it, but here is solution. Best UIComponent for Bitmap is mx:Image (no surprise), You can just write: &#60;mx :Image creationComplete=&#8221;(event.currentTarget as Image).source = new Bitmap( bitmapData)&#8221;/&#62; So for mx:Image except source=&#8221;path&#8221; you can add reference to Bitmap as well. Enjoy]]></description>
			<content:encoded><![CDATA[<div class='series_toc'><h3>Table of contents for flex-tips</h3><ol><li><a href='http://franto.com/flextips/' title='FlexTips'>FlexTips</a></li><li><a href='http://franto.com/flextips-mxtext-vs-mxtextarea/' title='FlexTip: mx:Text vs. mx:TextArea'>FlexTip: mx:Text vs. mx:TextArea</a></li><li><a href='http://franto.com/flextips-xmlsocket-connect-after-disconnect-from-server/' title='FlexTip: XMLSocket connect() after disconnect from server'>FlexTip: XMLSocket connect() after disconnect from server</a></li><li><a href='http://franto.com/flextips-problem-with-masks-and-scalable-flash/' title='FlexTip: Problem with masks and scalable Flash'>FlexTip: Problem with masks and scalable Flash</a></li><li>FlexTips: How to add Bitmap to UIComponent</li><li><a href='http://franto.com/flextips-stop-displaying-focus/' title='FlexTip &#8211; Stop displaying Focus'>FlexTip &#8211; Stop displaying Focus</a></li><li><a href='http://franto.com/preventing-checkbox-selection-with-keyspace/' title='FlexTip: Preventing CheckBox selection with Key.SPACE'>FlexTip: Preventing CheckBox selection with Key.SPACE</a></li><li><a href='http://franto.com/flextip-wordwrap-for-mxtext/' title='FlexTip: WordWrap for mx:Text'>FlexTip: WordWrap for mx:Text</a></li><li><a href='http://franto.com/add-thumbs-to-mxslider-programatically/' title='FlexTip: Add Thumbs to Mx:Slider programatically'>FlexTip: Add Thumbs to Mx:Slider programatically</a></li><li><a href='http://franto.com/as3-conditional-breakpoint-enterdebugger/' title='AS3 Conditional Breakpoint &#8211; enterDebugger()'>AS3 Conditional Breakpoint &#8211; enterDebugger()</a></li></ol></div> <div class="TweetButton_button" style="float: right; margin-left: 10px;;height:20px;margin-bottom:5px;"><a href="http://twitter.com/share?url=http%3A%2F%2Ffranto.com%2Fflextips-how-to-add-bitmap-to-uicomponent%2F&amp;text=FlexTips: How to add Bitmap to UIComponent&amp;count=vertical&amp;lang=en&amp;related=Flex,Flex+Tips"><img src="http://franto.com/blog2/wp-content/plugins/tweetbutton-for-wordpress/images/tweet.png" style="border:none" /></a></div>
<p>I didn&#8217;t know it, but here is solution. Best UIComponent for Bitmap is mx:Image <img src='http://franto.com/blog2/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  (no surprise), You can just write:</p>
<p><span style="color:white">&lt;mx :Image creationComplete=&#8221;(event.currentTarget as Image).source = new Bitmap( bitmapData)&#8221;/&gt;</span></p>
<p>So for mx:Image except source=&#8221;path&#8221; you can add reference to Bitmap as well.<br />
Enjoy</p>
 <div class='series_links'><a href='http://franto.com/flextips-problem-with-masks-and-scalable-flash/' title='FlexTip: Problem with masks and scalable Flash'>Previous in series</a> <a href='http://franto.com/flextips-stop-displaying-focus/' title='FlexTip &#8211; Stop displaying Focus'>Next in series</a></div>]]></content:encoded>
			<wfw:commentRss>http://franto.com/flextips-how-to-add-bitmap-to-uicomponent/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FlexTip: Problem with masks and scalable Flash</title>
		<link>http://franto.com/flextips-problem-with-masks-and-scalable-flash/</link>
		<comments>http://franto.com/flextips-problem-with-masks-and-scalable-flash/#comments</comments>
		<pubDate>Fri, 27 Jul 2007 06:39:35 +0000</pubDate>
		<dc:creator>Franto</dc:creator>
				<category><![CDATA[Flex Tips]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.franto.com/blog2/flextips-problem-with-masks-and-scalable-flash</guid>
		<description><![CDATA[This may be useful for someone who does not read Flex documentation in more detail. When you have content which is masked and you allow scale for your application, mask will not scale if it is not added to display list (it&#8217;s written in documentation ). So if you have such problem, add you mask [...]]]></description>
			<content:encoded><![CDATA[<div class='series_toc'><h3>Table of contents for flex-tips</h3><ol><li><a href='http://franto.com/flextips/' title='FlexTips'>FlexTips</a></li><li><a href='http://franto.com/flextips-mxtext-vs-mxtextarea/' title='FlexTip: mx:Text vs. mx:TextArea'>FlexTip: mx:Text vs. mx:TextArea</a></li><li><a href='http://franto.com/flextips-xmlsocket-connect-after-disconnect-from-server/' title='FlexTip: XMLSocket connect() after disconnect from server'>FlexTip: XMLSocket connect() after disconnect from server</a></li><li>FlexTip: Problem with masks and scalable Flash</li><li><a href='http://franto.com/flextips-how-to-add-bitmap-to-uicomponent/' title='FlexTips: How to add Bitmap to UIComponent'>FlexTips: How to add Bitmap to UIComponent</a></li><li><a href='http://franto.com/flextips-stop-displaying-focus/' title='FlexTip &#8211; Stop displaying Focus'>FlexTip &#8211; Stop displaying Focus</a></li><li><a href='http://franto.com/preventing-checkbox-selection-with-keyspace/' title='FlexTip: Preventing CheckBox selection with Key.SPACE'>FlexTip: Preventing CheckBox selection with Key.SPACE</a></li><li><a href='http://franto.com/flextip-wordwrap-for-mxtext/' title='FlexTip: WordWrap for mx:Text'>FlexTip: WordWrap for mx:Text</a></li><li><a href='http://franto.com/add-thumbs-to-mxslider-programatically/' title='FlexTip: Add Thumbs to Mx:Slider programatically'>FlexTip: Add Thumbs to Mx:Slider programatically</a></li><li><a href='http://franto.com/as3-conditional-breakpoint-enterdebugger/' title='AS3 Conditional Breakpoint &#8211; enterDebugger()'>AS3 Conditional Breakpoint &#8211; enterDebugger()</a></li></ol></div> <div class="TweetButton_button" style="float: right; margin-left: 10px;;height:20px;margin-bottom:5px;"><a href="http://twitter.com/share?url=http%3A%2F%2Ffranto.com%2Fflextips-problem-with-masks-and-scalable-flash%2F&amp;text=FlexTip: Problem with masks and scalable Flash&amp;count=vertical&amp;lang=en&amp;related=Flex,Flex+Tips"><img src="http://franto.com/blog2/wp-content/plugins/tweetbutton-for-wordpress/images/tweet.png" style="border:none" /></a></div>
<p>This may be useful for someone who does not read Flex documentation in more detail. When you have content which is masked and you allow scale for your application, mask will not scale if it is not added to display list (it&#8217;s written in documentation <img src='http://franto.com/blog2/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ). So if  you have such problem, add you mask to display list (addChild) and it solves your problem.</p>
<p>Another problem with scaling is mx:Text component. When you do not set width for Text, there is problem with resizing of you app. Some word from end of text can be not visible sometime. Setting width=&#8221;100%&#8221; is helpful&#8230;.</p>
<p>This we have found in our project. It&#8217;s just for apps which are scalable.</p>
<p>Hope this will help.</p>
 <div class='series_links'><a href='http://franto.com/flextips-xmlsocket-connect-after-disconnect-from-server/' title='FlexTip: XMLSocket connect() after disconnect from server'>Previous in series</a> <a href='http://franto.com/flextips-how-to-add-bitmap-to-uicomponent/' title='FlexTips: How to add Bitmap to UIComponent'>Next in series</a></div>]]></content:encoded>
			<wfw:commentRss>http://franto.com/flextips-problem-with-masks-and-scalable-flash/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

