<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4686657150124826716</id><updated>2012-02-02T10:59:06.953-08:00</updated><category term='resize'/><category term='mobile'/><category term='images'/><category term='swfloader'/><category term='prompt'/><category term='scrollbar'/><category term='can&apos;t type'/><category term='currentState'/><category term='drag handle'/><category term='StyleSheet'/><category term='path'/><category term='Lines'/><category term='dashed'/><category term='Flex Component Explorer'/><category term='Zen'/><category term='Vision'/><category term='progressbar'/><category term='Amazon'/><category term='remoteobject'/><category term='fonts'/><category term='Custom Marker'/><category term='Flex Library Project'/><category term='positioning'/><category term='AdvancedDataGrid'/><category term='validation'/><category term='title border'/><category term='ZVM'/><category term='cubic'/><category term='resizable controls'/><category term='Graphics'/><category term='cursors'/><category term='window'/><category term='Creative'/><category term='function'/><category term='Divider'/><category term='video'/><category term='motherboard'/><category term='firmware'/><category term='performance'/><category term='squiggly'/><category term='Series'/><category term='line'/><category term='grayscale'/><category term='custom component'/><category term='luminosity'/><category term='safari'/><category term='line numbers'/><category term='Yahoo Maps'/><category term='ObjectProxy'/><category term='parameters'/><category term='XML'/><category term='Styles'/><category term='trim'/><category term='default styles'/><category term='flex'/><category term='curve'/><category term='DataGridColumn'/><category term='rest'/><category term='split'/><category term='Filter'/><category term='Tree'/><category term='html'/><category term='color'/><category term='custom components'/><category term='swf'/><category term='highlighting'/><category term='scroll'/><category term='helper classes'/><category term='acer'/><category term='Legend'/><category term='error'/><category term='design mode'/><category term='animating'/><category term='icon button'/><category term='export swc oem'/><category term='DividedBox'/><category term='selected index'/><category term='list'/><category term='amfphp'/><category term='RadioButton'/><category term='drawTriangles'/><category term='states'/><category term='tablet'/><category term='resize handle'/><category term='ActionScript'/><category term='itemRenderer'/><category term='class construct'/><category term='tooltips'/><category term='full screen'/><category term='throbber'/><category term='youtube'/><category term='application'/><category term='validator'/><category term='context menu'/><category term='M'/><category term='effects'/><category term='track'/><category term='animation'/><category term='browser'/><category term='spark'/><category term='remoting'/><category term='error messages'/><category term='forms'/><category term='spell check'/><category term='height'/><category term='animate'/><category term='transitions'/><category term='background'/><category term='Chart'/><category term='textarea'/><category term='image'/><category term='HTTPService'/><category term='embed'/><category term='Spinner'/><category term='html tags'/><category term='debug'/><category term='titled border'/><category term='rating'/><category term='word count'/><category term='air'/><category term='internal classes'/><category term='header'/><category term='blendmode'/><category term='remote'/><category term='synchronized'/><category term='syntax highlighting'/><category term='live preview'/><category term='Resource Bundle RPC remote SWF'/><category term='book'/><category term='Web Service'/><category term='resizable'/><category term='containers'/><category term='rotation'/><category term='CheckBox'/><category term='Tour de Flex'/><category term='blogger'/><category term='3D'/><category term='Icon'/><category term='preloader'/><category term='words'/><category term='flex 4'/><category term='iconia'/><category term='StringWordValidator'/><category term='60gb'/><category term='scroller'/><category term='search'/><category term='multiple classes in same file'/><category term='index'/><category term='Spark Html'/><category term='Elevation'/><category term='htmlText'/><category term='text area'/><category term='bezier'/><category term='defaults.css'/><category term='flash builder 4.5'/><category term='error tips'/><title type='text'>Flex and ActionScript Development Tips</title><subtitle type='html'>An assortment of custom flex components, tricks and tips.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>73</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-6606287140651156845</id><published>2011-10-18T16:43:00.000-07:00</published><updated>2011-10-24T15:22:09.363-07:00</updated><title type='text'>Focus Flex App on start up</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-M0sKO9ovgcM/Tp4N48QszSI/AAAAAAAABAM/oeyMLTYxvnA/s1600/Screen%2Bshot%2B2011-10-18%2Bat%2B4.37.33%2BPM.png" imageanchor="1" style="clear:right; float:right; margin-left:1em; margin-bottom:1em"&gt;&lt;img border="0" height="180" width="301" src="http://4.bp.blogspot.com/-M0sKO9ovgcM/Tp4N48QszSI/AAAAAAAABAM/oeyMLTYxvnA/s400/Screen%2Bshot%2B2011-10-18%2Bat%2B4.37.33%2BPM.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br&gt;When a flex application loads it doesn't actually have focus until the user clicks on it.  &lt;br&gt;&lt;br&gt;So even though you can call &lt;b&gt;setFocus()&lt;/b&gt; on a &lt;b&gt;TextInput&lt;/b&gt; or &lt;b&gt;Button&lt;/b&gt; and visually it appears that your control has focus (blue border), if you try to type you'll notice that nothing happens.  This can be quite frustrating for a user.&lt;br&gt;&lt;br&gt;One way to solve this is to edit the html file that loads your application (e.g. the index.template.html), and call the JavaScript &lt;b&gt;focus()&lt;/b&gt; function on the flash element.  I found this website explains it quite nicely:&lt;br&gt;&lt;a href="http://www.appfoundation.com/blogs/giametta/2007/07/09/internet-explorer-setting-focus-on-flex-apps-flash-player/" target="_blank"&gt;http://www.appfoundation.com/blogs/giametta/2007/07/09/internet-explorer-setting-focus-on-flex-apps-flash-player/&lt;/a&gt;.&lt;br&gt;&lt;br&gt;If for prefer to keep all your code in ActionScript you can accomplish the same thing by doing this:&lt;div class="code"&gt;&amp;nbsp;ExternalInterface.call(&lt;b&gt;&lt;font color="#A21919"&gt;"function() { var app = document.getElementById('"&lt;/font&gt;&lt;/b&gt;+id+&lt;b&gt;&lt;font color="#A21919"&gt;"'); app.tabIndex = 0; app.focus(); }"&lt;/font&gt;&lt;/b&gt;);&lt;/div&gt;&lt;br&gt;I usually put that line of code inside my &lt;b&gt;applicationComplete&lt;/b&gt; event handler.&lt;br&gt;&lt;br&gt;One other thing to note is that if you call &lt;b&gt;setFocus&lt;/b&gt; on a component that isn't finished being initialized it won't always work.  For best results call &lt;b&gt;setFocus()&lt;/b&gt; in a &lt;b&gt;creationComplete&lt;/b&gt; event handler.&lt;br&gt;&lt;br&gt;I added the &lt;b&gt;app.tabIndex = 0&lt;/b&gt; after finding that the focus didn't work on Safari.  This came from &lt;a href="http://stackoverflow.com/questions/594821/object-focus-problem-with-safari-and-chrome-browsers" target="_blank"&gt;stackoverflow&lt;/a&gt;.&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-6606287140651156845?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/6606287140651156845/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=6606287140651156845&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/6606287140651156845'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/6606287140651156845'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2011/10/focus-flex-app-on-start-up.html' title='Focus Flex App on start up'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-M0sKO9ovgcM/Tp4N48QszSI/AAAAAAAABAM/oeyMLTYxvnA/s72-c/Screen%2Bshot%2B2011-10-18%2Bat%2B4.37.33%2BPM.png' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-7682153119891952501</id><published>2011-10-11T16:26:00.000-07:00</published><updated>2011-10-11T16:42:00.806-07:00</updated><title type='text'>FXG Scale Grid</title><content type='html'>When working with &lt;a href="http://opensource.adobe.com/wiki/display/flexsdk/FXG+2.0+Specification" target="_blank"&gt;FXG&lt;/a&gt; an important concept to understand is the &lt;a href="http://opensource.adobe.com/wiki/display/flexsdk/FXG+2.0+Specification#FXG2.0Specification-TheRootGraphicElement" target="_blank"&gt;Scale Grid&lt;/a&gt;.  The scale grid determines how your FXG graphic scales.  If your FXG element is used without an explicit width or height (e.g. &lt;font color='#2244FF'&gt;&amp;lt;fxg:rounded_box/&amp;gt;&lt;/font&gt;) then the scale grid is not used.  But if for example you define your FXG to have a width of 200 pixels and then in your MXML you use the FXG element and set its width to "100%" (e.g. &lt;font color='#2244FF'&gt;&amp;lt;fxg:rounded_box&lt;/font&gt; width="&lt;font color='#B01642'&gt;100%&lt;/font&gt;"&lt;font color='#2244FF'&gt;/&amp;gt;&lt;/font&gt;) or something other than 200 you'll see the graphic get scaled.  The scale grid becomes important when you want to preserve aspect ratios (e.g. on rounded corners).&lt;br/&gt;&lt;br/&gt;Here is the typical example used to illustrate the problem:&lt;div&gt;&lt;a href="http://3.bp.blogspot.com/-ziCOknA3vJY/TpTIu58JnZI/AAAAAAAAA_8/G2Gd6YbxDuk/s1600/scale_grid.png" imageanchor="1" style="margin-right:1em; margin-bottom:1em"&gt;&lt;img border="0" height="271" width="361" src="http://3.bp.blogspot.com/-ziCOknA3vJY/TpTIu58JnZI/AAAAAAAAA_8/G2Gd6YbxDuk/s400/scale_grid.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br/&gt;Here is the FXG source code (&lt;b&gt;rounded_box_scale9.fxg&lt;/b&gt;) used to create this graphic.  Notice the &lt;b&gt;scaleGridLeft&lt;/b&gt;, &lt;b&gt;scaleGridTop&lt;/b&gt;, &lt;b&gt;scaleGridRight&lt;/b&gt;, and &lt;b&gt;scaleGridBottom&lt;/b&gt; properties, these are what control the scaling.&lt;br/&gt;&lt;pre&gt;&lt;br /&gt;&lt;font color='#000000'&gt;&lt;font color='#2244FF'&gt;&amp;lt;s:Graphic&lt;/font&gt; xmlns:s="&lt;font color='#B01642'&gt;http://ns.adobe.com/fxg/2008&lt;/font&gt;" version="&lt;font color='#B01642'&gt;2.0&lt;/font&gt;" &lt;br /&gt;	&lt;b&gt;scaleGridTop="&lt;font color='#B01642'&gt;20&lt;/font&gt;" scaleGridLeft="&lt;font color='#B01642'&gt;20&lt;/font&gt;" scaleGridRight="&lt;font color='#B01642'&gt;130&lt;/font&gt;" scaleGridBottom="&lt;font color='#B01642'&gt;21&lt;/font&gt;"&lt;/b&gt;&lt;font color='#2244FF'&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;font color='#2244FF'&gt;&amp;lt;s:Rect&lt;/font&gt; height="&lt;font color='#B01642'&gt;41&lt;/font&gt;" width="&lt;font color='#B01642'&gt;150&lt;/font&gt;" radiusX="&lt;font color='#B01642'&gt;20&lt;/font&gt;"&lt;font color='#2244FF'&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;		&lt;font color='#2244FF'&gt;&amp;lt;s:fill&amp;gt;&lt;/font&gt;&lt;br /&gt;			&lt;font color='#2244FF'&gt;&amp;lt;s:LinearGradient&lt;/font&gt; rotation="&lt;font color='#B01642'&gt;90&lt;/font&gt;"&lt;font color='#2244FF'&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;				&lt;font color='#2244FF'&gt;&amp;lt;s:GradientEntry&lt;/font&gt; color="&lt;font color='#B01642'&gt;#FFFFFF&lt;/font&gt;"&lt;font color='#2244FF'&gt;/&amp;gt;&lt;/font&gt;&lt;br /&gt;				&lt;font color='#2244FF'&gt;&amp;lt;s:GradientEntry&lt;/font&gt; color="&lt;font color='#B01642'&gt;#C0C0C0&lt;/font&gt;"&lt;font color='#2244FF'&gt;/&amp;gt;&lt;/font&gt;&lt;br /&gt;				&lt;font color='#2244FF'&gt;&amp;lt;s:GradientEntry&lt;/font&gt; color="&lt;font color='#B01642'&gt;#FFFFFF&lt;/font&gt;"&lt;font color='#2244FF'&gt;/&amp;gt;&lt;/font&gt;&lt;br /&gt;			&lt;font color='#2244FF'&gt;&amp;lt;/s:LinearGradient&amp;gt;&lt;/font&gt;&lt;br /&gt;		&lt;font color='#2244FF'&gt;&amp;lt;/s:fill&amp;gt;&lt;/font&gt;&lt;br /&gt;		&lt;font color='#2244FF'&gt;&amp;lt;s:stroke&amp;gt;&lt;/font&gt;&lt;br /&gt;			&lt;font color='#2244FF'&gt;&amp;lt;s:SolidColorStroke&lt;/font&gt; color="&lt;font color='#B01642'&gt;#AAAAAA&lt;/font&gt;" weight="&lt;font color='#B01642'&gt;2&lt;/font&gt;"&lt;font color='#2244FF'&gt;/&amp;gt;&lt;/font&gt;&lt;br /&gt;		&lt;font color='#2244FF'&gt;&amp;lt;/s:stroke&lt;font color='#2244FF'&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;	&lt;font color='#2244FF'&gt;&amp;lt;/s:Rect&amp;gt;&lt;/font&gt;&lt;br /&gt;	&lt;br /&gt;&lt;font color='#2244FF'&gt;&amp;lt;/s:Graphic&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br/&gt;And here is the associated MXML (the &lt;b&gt;rounded_box&lt;/b&gt; fxg doesn't have the scaleGrid properties):&lt;br&gt;&lt;pre&gt;&lt;br /&gt;&lt;font color='#000000'&gt;&lt;font color='#2244FF'&gt;&amp;lt;s:VGroup&lt;/font&gt; x="&lt;font color='#B01642'&gt;10&lt;/font&gt;" y="&lt;font color='#B01642'&gt;10&lt;/font&gt;" gap="&lt;font color='#B01642'&gt;10&lt;/font&gt;"&lt;font color='#2244FF'&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;	&lt;font color='#2244FF'&gt;&amp;lt;fxg:rounded_box/&amp;gt;&lt;/font&gt;&lt;br /&gt;	&lt;font color='#2244FF'&gt;&amp;lt;fxg:rounded_box&lt;/font&gt; width="&lt;font color='#B01642'&gt;100&lt;/font&gt;"&lt;font color='#2244FF'&gt;/&amp;gt;&lt;/font&gt;&lt;br /&gt;	&lt;font color='#2244FF'&gt;&amp;lt;fxg:rounded_box&lt;/font&gt; width="&lt;font color='#B01642'&gt;200&lt;/font&gt;"&lt;font color='#2244FF'&gt;/&amp;gt;&lt;/font&gt;&lt;br /&gt;	&lt;font color='#2244FF'&gt;&amp;lt;fxg:rounded_box_scale9&lt;/font&gt; width="&lt;font color='#B01642'&gt;100&lt;/font&gt;"&lt;font color='#2244FF'&gt;/&amp;gt;&lt;/font&gt;&lt;br /&gt;	&lt;font color='#2244FF'&gt;&amp;lt;fxg:rounded_box_scale9&lt;/font&gt; width="&lt;font color='#B01642'&gt;200&lt;/font&gt;"&lt;font color='#2244FF'&gt;/&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;font color='#2244FF'&gt;&amp;lt;/s:VGroup&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br&gt;I found this website quite useful in illustrating some of the scale grid limitations:&lt;a href="http://www.adobe.com/devnet/flex/articles/mobile-skinning-part1.html" target="_blank"&gt;http://www.adobe.com/devnet/flex/articles/mobile-skinning-part1.html&lt;/a&gt;.&lt;br&gt;&lt;br&gt;And here is Adobe's page on FXG:&lt;br&gt;&lt;a href="http://help.adobe.com/en_US/flex/using/WSda78ed3a750d6b8f26c150d412357de3591-8000.html" target="_blank"&gt;http://help.adobe.com/en_US/flex/using/WSda78ed3a750d6b8f26c150d412357de3591-8000.html&lt;/a&gt;.&lt;br/&gt;&lt;br/&gt;But to summarize, here are the limitations I've found with scale grids:&lt;ul&gt;&lt;li&gt;Scale grid values must be inside the boundaries of the graphic and must not overlap&lt;br&gt;(that is, left boundary &amp;lt; scaleGridLeft &amp;lt; scaleGridRight &amp;lt; right boundary).&lt;/li&gt;&lt;li&gt;Scale grids will not work if the graphic contains any Group elements.&lt;/li&gt;&lt;li&gt;Scale grids will not work if elements have alpha applied. Instead, apply alpha to the stroke and fill elements.&lt;/li&gt;&lt;li&gt;Scale grids will not work with filters (e.g. DropShadow, GlowFilter, etc).  Instead add the filters inside the MXML.&lt;/li&gt;&lt;/ul&gt;I'm sure there are more restrictions, but these are what I've found so far.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-7682153119891952501?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/7682153119891952501/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=7682153119891952501&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7682153119891952501'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7682153119891952501'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2011/10/fxg-scale-grid.html' title='FXG Scale Grid'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-ziCOknA3vJY/TpTIu58JnZI/AAAAAAAAA_8/G2Gd6YbxDuk/s72-c/scale_grid.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-2143539262917878283</id><published>2011-09-21T14:41:00.000-07:00</published><updated>2012-02-02T10:59:06.964-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='line'/><category scheme='http://www.blogger.com/atom/ns#' term='curve'/><category scheme='http://www.blogger.com/atom/ns#' term='bezier'/><category scheme='http://www.blogger.com/atom/ns#' term='path'/><title type='text'>Flex 4 Path Builder</title><content type='html'>&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex4.5/pathbuilder/FlexPathBuilder.html?v=1.1" target="_blank"&gt;&lt;img src="http://chris.firlingcanada.com/flexdevtips/flex4.5/pathbuilder/screenshot.png" border="0" width="700"/&gt;&lt;/a&gt;&lt;br/&gt;&lt;b&gt;&lt;font color="#663399"&gt;Updated on November 17th with a new version.&lt;/font&gt;&lt;/b&gt;&lt;br&gt;&lt;br&gt;I got a little carried away making an application that lets you manipulate Flex &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/primitives/Path.html" target="_blank"&gt;Path&lt;/a&gt; objects. This application lets you easily design a path by &lt;b&gt;double clicking&lt;/b&gt; to make each end point in your path. You can select each individual line, move, or curve segment and manipulate the end points (&lt;img src="http://chris.firlingcanada.com/flexdevtips/flex4.5/pathbuilder/endpoint.png" style="border:0" align="middle"/&gt;) and the curve control points (&lt;img src="http://chris.firlingcanada.com/flexdevtips/flex4.5/pathbuilder/controlpoint.png" style="border:0" align="middle"/&gt;). Click on the screenshot above to see it in action.  I'm sure there will be bugs, so use at your own risk.  There is no undo support either.&lt;br/&gt;&lt;br/&gt;To use this tool, you can start by adding different kind of path segments - move, lines, and curves - by clicking on one of the 6 buttons along the top in the blue titlebar.  This will cause the path segment to be appended to the currently displayed path.  Each path segment also shows up in the list on the left side.  Click on an individual path segment in this list to highlight it in the path. The &lt;span style='color: #C93C3C'&gt;red&lt;/span&gt; end points (&lt;img src="http://chris.firlingcanada.com/flexdevtips/flex4.5/pathbuilder/endpoint.png" style="border:0" align="middle"/&gt;) are draggable - move them around to adjust the path.  Note that the following path segment will be moved to start wherever the current path segment ends.You can also click and drag the circle control points (&lt;img src="http://chris.firlingcanada.com/flexdevtips/flex4.5/pathbuilder/controlpoint.png" style="border:0" align="middle"/&gt;) to adjust the quadratic and cubic Bezier Curves.&lt;br&gt;Alternatively you can use the new "Path Designer" option (which is explained in the top panel on the left side). The path designer lets you double click on the white graph area to create each segment of your path. Here are the instructions:&lt;br&gt;&lt;ul&gt;&lt;li&gt;To create a &lt;b&gt;line&lt;/b&gt;: Double-click on the graph&lt;/li&gt;&lt;li&gt;To create a &lt;b&gt;straight line&lt;/b&gt; (horizontal, vertical, or at 45°): Shift + double-click on the graph&lt;/li&gt;&lt;li&gt;To create a &lt;b&gt;quadradic curve&lt;/b&gt;: Ctrl(⌘) + double-click on the graph (you can edit the control point later)&lt;/li&gt;&lt;li&gt;To create a &lt;b&gt;cubic bezier curve&lt;/b&gt;: Ctrl(⌘) + shift + double-click on the graph&lt;/li&gt;&lt;li&gt;If you check the &lt;b&gt;Use relative positions&lt;/b&gt; checkbox the path segments will use relative positions instead of absolute (lower case letters like "l", "m", "c", "q", etc)&lt;/li&gt;&lt;li&gt;If you check the &lt;b&gt;Snap To Grid&lt;/b&gt; checkbox, then the end points are all shifted to fit on a grid defined by the number of pixels you choose.  This is a nice way to easily get nice round numbers like 20, 50, 100.&lt;/li&gt;&lt;/ul&gt;&lt;br/&gt;If you have an existing path you can paste the data string (e.g. "M 100 100 L 150 150 H 200") into the textbox at the top and click &lt;b&gt;Update&lt;/b&gt;.  This will render your path on the screen and allow you to manipulate it.&lt;br/&gt;&lt;br/&gt;I've also added support for ActionScript &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/GraphicsPath.html" target="_blank"&gt;GraphicsPath&lt;/a&gt; commands to be pasted in the same textbox in this format:&lt;br&gt;&lt;b&gt;"1 2;10 10 20 20"&lt;/b&gt;&lt;br/&gt;The first set of numbers before the semi-colon are the commands (defined by the constants in &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/GraphicsPathCommand.html" target="_blank"&gt;GraphicsPathCommand&lt;/a&gt;). The second set of numbers after the semi-colon are the coordinates of each path segment. In your program you can use a trace statements like this on your GraphicsPath object to output the correct format:&lt;br&gt;&lt;div class="code"&gt;trace(path.commands.join(" ") + ";" + path.data.join(" "));&lt;/div&gt;&lt;br/&gt;And finally, if you have a path created in ActionScript using a &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Graphics.html" target="_blank"&gt;Graphics&lt;/a&gt; object or a &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/GraphicsPath.html" target="_blank"&gt;GraphicsPath&lt;/a&gt; object like this:&lt;pre&gt;&lt;br /&gt;var g:Graphics = uiComponent.graphics;&lt;br /&gt;g.moveTo(10, 10);&lt;br /&gt;g.lineTo(50, 10);&lt;br /&gt;g.moveTo(50, 50);&lt;br /&gt;g.lineTo(10, 50);&lt;br /&gt;&lt;/pre&gt;You can copy that code and paste it into the same textbox at the top. It will pick out the move, line, and quad curve commands.  This will only work if you use all numbers in your code - no variables or constants.&lt;br/&gt;&lt;br/&gt;The &lt;b&gt;Translate&lt;/b&gt; X/Y option lets you move every single point on the screen by the given x and y offset values.  This includes the control points.  So think of it as shifting the entire path.  Note that the points can't be moved into negative values (even though they are allowed), so unexpected things will happen if you try to do this.&lt;br/&gt;&lt;br/&gt;On the right side of the app (not shown in the screenshot) there is an edit panel which lets you type in the exact numeric values that you want for each point in the selected path segment.  This way you can easily tweak your path to look just right.&lt;br/&gt;&lt;br/&gt;Below the Edit Panel is the &lt;b&gt;Stroke &amp;amp; Fill Properties&lt;/b&gt; panel.  This lets you define the path stroke and fill properties.&lt;br/&gt;&lt;br/&gt;Below that is the MXML and FXG output windows which let you copy the MXML/FXG source code used to render the path, so you can paste it into your own application. If you are using FXG, then in Flash Builder choose "File &amp;gt; New &amp;gt; File". Then enter in the filename you want like "mypath.fxg".  In the editor paste in the FXG, it has all the declaration xml that you should need.&lt;br/&gt;&lt;br/&gt;Feedback welcome, have fun playing.  &lt;br/&gt;&lt;br/&gt;I haven't enabled view-source for this project yet, hopefully one day.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-2143539262917878283?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/2143539262917878283/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=2143539262917878283&amp;isPopup=true' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/2143539262917878283'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/2143539262917878283'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2011/09/flex-4-path-builder.html' title='Flex 4 Path Builder'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-5736360409157925827</id><published>2011-08-29T11:01:00.000-07:00</published><updated>2011-08-29T11:01:40.575-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='can&apos;t type'/><category scheme='http://www.blogger.com/atom/ns#' term='debug'/><category scheme='http://www.blogger.com/atom/ns#' term='safari'/><title type='text'>Can't type into Flex textbox on Mac Safari 5.1!</title><content type='html'>I recently ran into a problem on Mac Safari 5.1 where I couldn't type into any text boxes in my Flex App.  Very frustrating!  Anyway, I finally found a simple solution from the &lt;a href="http://forums.adobe.com/thread/881989" target="_blank"&gt;Adobe Forums&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;First this problem only happens with the Debug Flash Player.&lt;br /&gt;&lt;br /&gt;The fix is very simple - in Safari under the &lt;b&gt;Develop&lt;/b&gt; menu (if you don't see the Develop menu it can be shown by going to &lt;nobr&gt;&lt;b&gt;Preferences&lt;/b&gt; &amp;gt; &lt;b&gt;Advanced&lt;/b&gt;&lt;/nobr&gt; and checking the &lt;b&gt;Show Develop menu in menu bar&lt;/b&gt; checkbox), change the &lt;b&gt;User-Agent&lt;/b&gt; to Firefox or something other than the default.  This will cause the page to reload, and should allow you to type again.&lt;br /&gt;&lt;br /&gt;Bizarre.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-5736360409157925827?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/5736360409157925827/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=5736360409157925827&amp;isPopup=true' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/5736360409157925827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/5736360409157925827'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2011/08/cant-type-into-flex-textbox-on-mac.html' title='Can&apos;t type into Flex textbox on Mac Safari 5.1!'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-8546438500429268244</id><published>2011-06-27T14:49:00.000-07:00</published><updated>2012-01-27T15:45:44.350-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='application'/><category scheme='http://www.blogger.com/atom/ns#' term='mobile'/><category scheme='http://www.blogger.com/atom/ns#' term='flash builder 4.5'/><category scheme='http://www.blogger.com/atom/ns#' term='tablet'/><category scheme='http://www.blogger.com/atom/ns#' term='iconia'/><category scheme='http://www.blogger.com/atom/ns#' term='acer'/><title type='text'>Flash Builder 4.5 Mobile Application for Acer Iconia A500 Tablet</title><content type='html'>&lt;iframe src="http://rcm.amazon.com/e/cm?t=fle07-20&amp;o=1&amp;p=8&amp;l=bpl&amp;asins=B004XZL980&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;m=amazon&amp;lc1=0000FF&amp;bc1=000000&amp;bg1=FFFFFF&amp;f=ifr" style="align:right;width:131px;height:245px;padding-left:20px;"align="right" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"&gt;&lt;/iframe&gt;This blog post will discuss making a simple mobile application using Flash Builder 4.5.  I will be targeting the &lt;a href="http://www.acer.ca/ac/en/CA/content/iconia-tab-a500" target="_blank"&gt;Acer Iconia A500 Tablet&lt;/a&gt; because it is currently the only mobile device that I have access to, but it should be relevant to other mobile devices too.  The Acer Iconia A500 Tablet runs on &lt;a href="http://developer.android.com/sdk/android-3.0-highlights.html"&gt;Google Android 3.0&lt;/a&gt; (Honeycomb).  For a full review of the tablet, read this &lt;a href="http://www.displayblog.com/2011/04/26/acer-iconia-tab-a500-review/" target="_blank"&gt;article&lt;/a&gt;. It sells for around $450 for the 32GB version.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Step 1 - configure the tablet&lt;/h3&gt;On the tablet go to &lt;b&gt;Settings - Applications - Development&lt;/b&gt;&lt;br /&gt;Check the &lt;b&gt;USB Debugging&lt;/b&gt; option.  This allows Flash Builder to debug applications straight on to the tablet through USB. Next, connect the tablet to your computer using the USB cable provided.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Step2 - create a mobile project&lt;/h3&gt;Inside Flash Builder, create a new &lt;b&gt;Flex Mobile Project&lt;/b&gt;.&lt;br /&gt;Give it a name like &lt;b&gt;TabletApp&lt;/b&gt;. Click Next.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-mySAjiceGqw/TgjyChUlllI/AAAAAAAAA8E/Nd7TPUbdXHE/s1600/project_name.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="309" width="400" src="http://2.bp.blogspot.com/-mySAjiceGqw/TgjyChUlllI/AAAAAAAAA8E/Nd7TPUbdXHE/s400/project_name.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Select the desired target platform(s).  For the Acer Iconia and other Andoid tablets, check the &lt;b&gt;Google Android&lt;/b&gt; checkbox.  You can choose the mobile app template to use here as well.&lt;br /&gt;&lt;i&gt;Important&lt;/i&gt;: your mobile application might need to have access to the internet, the file system, the gps, etc.  Under the Permissions tab, choose the &lt;b&gt;Google Android&lt;/b&gt; platform, and check any of the permissions that your application needs.&lt;br /&gt;For my sample application I chose the &lt;font color="#39305A"&gt;&lt;b&gt;INTERNET&lt;/b&gt;&lt;/font&gt;, &lt;font color="#39305A"&gt;&lt;b&gt;WRITE_EXTERNAL_STORAGE&lt;/b&gt;&lt;/font&gt;, and &lt;font color="#39305A"&gt;&lt;b&gt;ACCESS_FINE_LOCATION&lt;/b&gt;&lt;/font&gt; (GPS) permissions.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-rO-5r11sm3E/TgjyKQVFTOI/AAAAAAAAA8M/5dm5QuhJ710/s1600/project_mobile_settings.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="340" width="400" src="http://1.bp.blogspot.com/-rO-5r11sm3E/TgjyKQVFTOI/AAAAAAAAA8M/5dm5QuhJ710/s400/project_mobile_settings.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-6TkiVjzmdZ8/TgjyOpIfm5I/AAAAAAAAA8U/HT-RbpfjvSY/s1600/project_mobile_permissions.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="157" width="400" src="http://4.bp.blogspot.com/-6TkiVjzmdZ8/TgjyOpIfm5I/AAAAAAAAA8U/HT-RbpfjvSY/s400/project_mobile_permissions.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Click next.  Set up the build path if necessary, or leave it to the default values.&lt;br /&gt;&lt;br /&gt;Once the project is created, Flash Builder will open the two main files - &lt;b&gt;TabletApp.mxml&lt;/b&gt; (the main application file), and &lt;b&gt;TabletAppHomeView.mxml&lt;/b&gt; (the default home view component). Add in some components to the home view like a button or a label. &lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Step 3 - Run the application on the tablet&lt;/h3&gt;Now, to test our your application on the Acer Iconia Tablet, make sure it is connected by USB, and that you followed the step above on the tablet to enable USB debugging.&lt;br /&gt;&lt;br /&gt;Under the &lt;b&gt;Run&lt;/b&gt; menu, choose &lt;b&gt;Debug Configurations...&lt;/b&gt;.  Add a new &lt;b&gt;Mobile Application&lt;/b&gt; launch configuration.  Choose your project and application, and the target platform (Google Android in this case).&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-ODvTw986yTs/Tgj0O3vr-CI/AAAAAAAAA8c/b9th2vd5AUA/s1600/launch_configuration.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="294" width="400" src="http://1.bp.blogspot.com/-ODvTw986yTs/Tgj0O3vr-CI/AAAAAAAAA8c/b9th2vd5AUA/s400/launch_configuration.png" /&gt;&lt;/a&gt;&lt;/div&gt;Under where it says "Launch method", choose the &lt;b&gt;On device&lt;/b&gt; radio button.  If you have trouble connecting, then read the &lt;a href="http://help.adobe.com/en_US/flex/mobileapps/WSa8161994b114d624-33657d5912b7ab2d73b-7fdf.html" target="_blank"&gt;&lt;u&gt;Device connection help&lt;/u&gt;&lt;/a&gt; page.&lt;br /&gt;&lt;br /&gt;If all works as planned, you should see on the tablet the simple application that you created.  &lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Step 3b - Run the application on the desktop&lt;/h3&gt;If you want to test out your application without running it on the tablet, you can run it on the desktop by choosing the other radio button option - &lt;b&gt;On desktop&lt;/b&gt;.  There is a list of pre-configured devices, but the Acer Iconia tablet isn't in the list.  So click &lt;b&gt;Configure...&lt;/b&gt; and then &lt;b&gt;Add&lt;/b&gt; to add it to the list.  Here are the specs:&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-x__tmMOBHRg/Tgj39Bfv5gI/AAAAAAAAA8s/AmJMF5bneqM/s1600/launch_configuration_device.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="311" width="400" src="http://2.bp.blogspot.com/-x__tmMOBHRg/Tgj39Bfv5gI/AAAAAAAAA8s/AmJMF5bneqM/s400/launch_configuration_device.png" /&gt;&lt;/a&gt;&lt;a href="http://2.bp.blogspot.com/-pSmmXqpUjkI/Tgj4Al6hvYI/AAAAAAAAA80/kroiGHkISIc/s1600/add_device.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="306" width="400" src="http://2.bp.blogspot.com/-pSmmXqpUjkI/Tgj4Al6hvYI/AAAAAAAAA80/kroiGHkISIc/s400/add_device.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;I've put together a simple app that shows some of the properties available to mobile applications.  Click the screenshot below to see the full size.&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-qbckrStWoi8/Tgj2_EVvgZI/AAAAAAAAA8k/Fe4C0NHt0ko/s1600/mobile_app_screenshot.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="221" width="400" src="http://2.bp.blogspot.com/-qbckrStWoi8/Tgj2_EVvgZI/AAAAAAAAA8k/Fe4C0NHt0ko/s400/mobile_app_screenshot.png" /&gt;&lt;/a&gt;&lt;/div&gt;You can download the project file &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex4.5/mobileapp/TabletApp.fxp"&gt;here&lt;/a&gt;.  In Flash Builder choose "File - Import...", and then choose "Flash Builder - Flash Builder Project", and select the downloaded &lt;b&gt;fxp&lt;/b&gt; file.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-8546438500429268244?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/8546438500429268244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=8546438500429268244&amp;isPopup=true' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/8546438500429268244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/8546438500429268244'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2011/06/flash-builder-45-mobile-application-for.html' title='Flash Builder 4.5 Mobile Application for Acer Iconia A500 Tablet'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-mySAjiceGqw/TgjyChUlllI/AAAAAAAAA8E/Nd7TPUbdXHE/s72-c/project_name.png' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-7180322484174563177</id><published>2011-05-19T17:44:00.000-07:00</published><updated>2012-01-27T15:44:09.114-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Spinner'/><category scheme='http://www.blogger.com/atom/ns#' term='preloader'/><category scheme='http://www.blogger.com/atom/ns#' term='animating'/><category scheme='http://www.blogger.com/atom/ns#' term='throbber'/><title type='text'>Simple Animating Preloader and Throbber/Spinner</title><content type='html'>This is my fourth post on Flex preloaders.  It shows how you can use a throbber or spinner as a&lt;br /&gt;simple yet effective preloader.  The throbber can also be used in your application in other places whenever you want to indicate that something is happening.&lt;br /&gt;&lt;br /&gt;In the example below I've included two kinds of throbbers:&lt;ul&gt;&lt;li&gt;&lt;b&gt;SimpleThrobber&lt;/b&gt; (extends Sprite) - ActionScript/Flash only, no Flex dependencies (good for preloaders)&lt;/li&gt;&lt;li&gt;&lt;b&gt;Throbber&lt;/b&gt; (extends SkinnableContainer) - advanced throbber, skinnable and style-able&lt;/li&gt;&lt;/ul&gt;I've also included two skins to go with the &lt;b&gt;Throbber&lt;/b&gt; class - &lt;b&gt;ThrobberCirclesSkin&lt;/b&gt; and &lt;b&gt;ThrobberLinesSkin&lt;/b&gt;.  &lt;br /&gt;&lt;br /&gt;Both throbbers work roughly the same way.  The animation is performed every X milliseconds, and the lines or circles are drawn in a rotating manner so that the throbber animates.  Both throbbers support an array of &lt;b&gt;colors&lt;/b&gt; which define the appearance of the throbber, and a &lt;b&gt;delay&lt;/b&gt; property which determines the speed of the animation.  &lt;br /&gt;&lt;br /&gt;Anyway, check out the code below (right click &lt;b&gt;View Source&lt;/b&gt; to see the source), there is some documentation to explain the various styles, properties, and functions.&lt;br /&gt;&lt;iframe frameborder="0" height="250" marginheight="0" marginwidth="0" scrolling="no" src="http://chris.firlingcanada.com/flexdevtips/flex4/throbber/SimpleThrobberApp.html" width="640"&gt;&lt;/iframe&gt; &lt;br /&gt;&lt;br /&gt;The other blog posts I've written on preloaders and spinners/throbbers can be found here:&lt;ul&gt;&lt;li&gt;&lt;a href="http://flexdevtips.blogspot.com/2009/03/another-custom-preloader.html" target="_blank"&gt;Another Custom Preloader&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://flexdevtips.blogspot.com/2009/03/showing-preloader-again-after-loading.html" target="_blank"&gt;Showing Preloader Again&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://flexdevtips.blogspot.com/2011/01/grayscale-preloader.html" target="_blank"&gt;Grayscale Preloader&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://flexdevtips.blogspot.com/2009/04/tree-icon-spinner-not-using-animated.html" target="_blank"&gt;Tree Icon Spinner&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;As mentioned in the comments, the just released &lt;b&gt;Flex 4.5 SDK&lt;/b&gt; now contains a similar &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/BusyIndicator.html" target="_blank"&gt;Spark BusyIndicator&lt;/a&gt; component.  There is a nice blog post on it &lt;a href="http://fusiongrokker.com/post/using-the-flex-4-5-busyindicator" target="_blank"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-7180322484174563177?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/7180322484174563177/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=7180322484174563177&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7180322484174563177'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7180322484174563177'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2011/05/simple-animating-preloader-and.html' title='Simple Animating Preloader and Throbber/Spinner'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-3459815364731927122</id><published>2011-03-24T12:50:00.000-07:00</published><updated>2012-01-27T15:42:32.409-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='forms'/><category scheme='http://www.blogger.com/atom/ns#' term='error'/><category scheme='http://www.blogger.com/atom/ns#' term='spark'/><category scheme='http://www.blogger.com/atom/ns#' term='validation'/><title type='text'>Spark Forms, Validation, and Errors</title><content type='html'>One of my previous posts on &lt;a href="http://flexdevtips.blogspot.com/2009/08/always-showing-error-tips-validators.html" target="_blank"&gt;Always showing error tips (validators)&lt;/a&gt; presented one way of trying and improve the built-in validation error handling in Flex.  It was a nice idea, but as many people have pointed out in the comments there are too many different use cases that causes the error tips to not show up properly.&lt;br /&gt;&lt;br /&gt;Below is another alternative approach, and one that I hope is less of a hack.&lt;br /&gt;&lt;br /&gt;I've created a class called &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex4/inputcontrol/srcview/source/flex/utils/spark/inputControl/InputControl.as.html" target="_blank"&gt;InputControl&lt;/a&gt; which is very similar to the Flex 3 &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/containers/FormItem.html" target="_blank"&gt;FormItem&lt;/a&gt;.  It has a &lt;b&gt;label&lt;/b&gt; property, and can contain one or more child elements.&lt;br /&gt;&lt;br /&gt;What this control does that makes it useful is to listen for when the &lt;b&gt;errorString&lt;/b&gt; property changes on an input control (such as a TextInput), and instead of displaying the default Flex error toolTip, it shows that errorString in a label that is always visible.  It also immediately clears the input's errorString property so that the default error toolTip is not displayed.&lt;br /&gt;&lt;br /&gt;The &lt;b&gt;InputControl&lt;/b&gt; class is skinnable, and I've created two different skins.  The default one &lt;b&gt;InputControlSkin&lt;/b&gt; has the same layout as the FormItem (label on the left) and displays the error string on the right of the input.&lt;br /&gt;&lt;br /&gt;The second skin is called &lt;b&gt;InputControlVerticalSkin&lt;/b&gt; which displays the label, input, and error message in a vertical layout.  This skin is more suited for large inputs like a TextArea.&lt;br /&gt;&lt;br /&gt;There are definitely a few issues with this approach: &lt;br /&gt;- longer error messages either don't show up properly or are truncated&lt;br /&gt;- form label alignment is not customizable&lt;br /&gt;&lt;br /&gt;Feel free to modify my code to make it work differently.  Most properties are hard coded in the skins, and I didn't spend the time to extract them out into styles.&lt;br /&gt;&lt;br /&gt;Here it is in action, right click to view source:&lt;br /&gt;&lt;iframe frameborder="0" height="370" marginheight="0" marginwidth="0" scrolling="no" src="http://chris.firlingcanada.com/flexdevtips/flex4/inputcontrol/InputControlApp.html" width="600"&gt;&lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-3459815364731927122?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/3459815364731927122/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=3459815364731927122&amp;isPopup=true' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/3459815364731927122'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/3459815364731927122'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2011/03/spark-forms-validation-and-errors.html' title='Spark Forms, Validation, and Errors'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-98010809389688719</id><published>2011-03-15T16:13:00.000-07:00</published><updated>2012-01-27T15:41:28.064-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='transitions'/><category scheme='http://www.blogger.com/atom/ns#' term='animation'/><category scheme='http://www.blogger.com/atom/ns#' term='currentState'/><category scheme='http://www.blogger.com/atom/ns#' term='states'/><category scheme='http://www.blogger.com/atom/ns#' term='effects'/><title type='text'>State Transitions</title><content type='html'>I've put together a little example of how you can use &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/core/UIComponent.html#transitions" target="_blank"&gt;transitions&lt;/a&gt; to animate between the &lt;b&gt;states&lt;/b&gt; in your application component.&lt;br /&gt;&lt;br /&gt;There are many websites explaining &lt;a href="http://livedocs.adobe.com/flex/3/html/help.html?content=using_states_3.html" target="_blank"&gt;Flex 3 states&lt;/a&gt; as well as the new and improved &lt;a href="http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7fb4.html" target="_blank"&gt;Flex 4 states&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;If you don't already use states, I would highly recommend you become familiar with them.  They are very powerful, and make it much easier to create complex user interfaces.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Transitions&lt;/b&gt; are &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/effects/Effect.html" target="_blank"&gt;effects&lt;/a&gt; that are played when your component changes from one state to another state.  They are a nice way to smoothly animate changing content, for example fading out content being hidden, or resizing containers that have new elements being added.&lt;br /&gt;&lt;br /&gt;In the example below, I've created an application that has 5 states:&lt;ul&gt;&lt;li&gt;&lt;b&gt;Normal&lt;/b&gt; - default state&lt;/li&gt;&lt;li&gt;&lt;b&gt;Resize&lt;/b&gt; - resizes the main panel using a &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/effects/Resize.html" target="_blank"&gt;Resize&lt;/a&gt; effect&lt;/li&gt;&lt;li&gt;&lt;b&gt;Fade&lt;/b&gt; - fades in/out a Label using a &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/effects/Fade.html" target="_blank"&gt;Fade&lt;/a&gt; effect&lt;/li&gt;&lt;li&gt;&lt;b&gt;AnimateColor&lt;/b&gt; - animates a gradient color using the &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/effects/AnimateColor.html" target="_blank"&gt;AnimateColor&lt;/a&gt; effect&lt;/li&gt;&lt;li&gt;&lt;b&gt;Easing&lt;/b&gt; - uses a &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/effects/easing/Bounce.html" target="_blank"&gt;Bounce&lt;/a&gt; &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/effects/Animate.html#easer" target="_blank"&gt;easer&lt;/a&gt; with a &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/effects/Move.html" target="_blank"&gt;Move&lt;/a&gt; transition&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;I've noticed that certain effects like &lt;b&gt;Resize&lt;/b&gt; don't work properly with other effects like &lt;b&gt;Fade&lt;/b&gt;.  I haven't spent the time to try and figure out why not.&lt;br /&gt;&lt;br /&gt;Anyway, here is the example.  Right click to view source.&lt;br /&gt;&lt;iframe frameborder="0" height="250" marginheight="0" marginwidth="0" scrolling="no" src="http://chris.firlingcanada.com/flexdevtips/flex4/transitions/TransitionsApp.html" width="450"&gt;&lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-98010809389688719?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/98010809389688719/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=98010809389688719&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/98010809389688719'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/98010809389688719'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2011/03/state-transitions.html' title='State Transitions'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-7919328757598177026</id><published>2011-01-26T16:53:00.000-08:00</published><updated>2012-01-27T15:40:27.310-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scroll'/><category scheme='http://www.blogger.com/atom/ns#' term='selected index'/><category scheme='http://www.blogger.com/atom/ns#' term='index'/><category scheme='http://www.blogger.com/atom/ns#' term='animate'/><category scheme='http://www.blogger.com/atom/ns#' term='list'/><category scheme='http://www.blogger.com/atom/ns#' term='scrollbar'/><title type='text'>Animated Scrolling List</title><content type='html'>In Flex 4, the Spark &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/List.html" target="_blank"&gt;List&lt;/a&gt; has a function called &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/List.html#ensureIndexIsVisible()" target="_blank"&gt;ensureIndexIsVisible(index)&lt;/a&gt;.  This function immediately scrolls the list to that index if it is not visible.&lt;br /&gt;&lt;br /&gt;I've added a slight modification to this to animate the scrolling over half a second to make it much smoother.  The animation is done using an &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/effects/AnimateProperty.html" target="_blank"&gt;AnimateProperty&lt;/a&gt; instance on the list's data group, and setting the &lt;b&gt;property&lt;/b&gt; to &lt;b&gt;verticalScrollPosition&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;Here it is in action, as usual right click to view source:&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex4/animatedscrollinglist/AnimatedScrollingListApp.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="330" height="165"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;For simplicity I am only scrolling the vertical scrollbar.  If you are using a horizontal or tiled list, you'll want to animate the horizontal scrollbar too.  In the tile case, you could use a &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/effects/Parallel.html" target="_blank"&gt;Parallel&lt;/a&gt; instance to animate both the horizontal and vertical scrollbars.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-7919328757598177026?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/7919328757598177026/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=7919328757598177026&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7919328757598177026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7919328757598177026'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2011/01/animated-scrolling-list.html' title='Animated Scrolling List'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-9176874610422168898</id><published>2011-01-14T12:34:00.000-08:00</published><updated>2012-01-27T15:39:03.340-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='preloader'/><category scheme='http://www.blogger.com/atom/ns#' term='grayscale'/><title type='text'>Grayscale Preloader</title><content type='html'>Following on from my last post on &lt;a href="http://flexdevtips.blogspot.com/2011/01/grayscale-images-progressbar-rating.html" target="_blank"&gt;grayscale images&lt;/a&gt;, I've made another preloader to illustrate how you can animate an image from grayscale to colour.&lt;br /&gt;&lt;br /&gt;The preload consists of an image and a loading label.  The image starts off gray, and as the preloader progress value increases it gradually becomes coloured.  The alpha value also increases from 0.5 at the start to 1 at the end.  To spice it up a little I also added in a &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/filters/GlowFilter.html" target="_blank"&gt;GlowFilter&lt;/a&gt; and a &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/filters/DropShadowFilter.html" target="_blank"&gt;DropShadowFilter&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Here it is in action, click the &lt;b&gt;RELOAD&lt;/b&gt; button to show the preloader again.&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex4/grayscalepreloader/GrayscalePreloaderApp.html?v=1" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="500" height="400"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For another example of a custom preloader, check out this blog post on &lt;a href="http://flexdevtips.blogspot.com/2009/03/another-custom-preloader.html"&gt;Another Custom Preloader&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-9176874610422168898?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/9176874610422168898/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=9176874610422168898&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/9176874610422168898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/9176874610422168898'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2011/01/grayscale-preloader.html' title='Grayscale Preloader'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-3078621490827209957</id><published>2011-01-07T15:19:00.000-08:00</published><updated>2012-01-27T15:38:02.717-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rating'/><category scheme='http://www.blogger.com/atom/ns#' term='progressbar'/><category scheme='http://www.blogger.com/atom/ns#' term='images'/><category scheme='http://www.blogger.com/atom/ns#' term='blendmode'/><category scheme='http://www.blogger.com/atom/ns#' term='luminosity'/><category scheme='http://www.blogger.com/atom/ns#' term='grayscale'/><title type='text'>Grayscale Images, ProgressBar, Rating Control</title><content type='html'>I've been learning some neat tricks for working with images and graphics.  One of them is how to take a color image (or a graphic like an ellipse that you've drawn using MXML/FXG) and make it grayscale.&lt;br /&gt;&lt;br /&gt;Obviously if you have the image, you could just as easily open it up in your favorite image editor like Photoshop and make a grayscale copy of the image and save it to your Flex project.  &lt;br /&gt;&lt;br /&gt;Anyway, here is how you can do it dynamically.  I've shown two different ways of doing it.  Again I want to emphasize that &lt;i&gt;all&lt;/i&gt; the images and graphics below are in color, they are simply modified at run time to appear in grayscale.&lt;br /&gt;&lt;br /&gt;The first way is to set the &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/core/UIComponent.html#blendMode" target="_blank"&gt;UIComponent.blendMode&lt;/a&gt; or &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/primitives/supportClasses/GraphicElement.html#blendMode" target="_blank"&gt;GraphicElement.blendMode&lt;/a&gt; property to &lt;b&gt;"luminosity"&lt;/b&gt; on the image or graphic.  This method works by blending the colours in the image with the color "behind" the image (usually the background color of the parent container or application). So if the color behind the image is white or light gray, then the image will become gray.  If the color behind is green, then the image will be colourized to green.  See the bottom part of example #6 where 4 red circles are drawn with various background colours.  &lt;br /&gt;&lt;br /&gt;The second way is to use a &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/filters/ColorMatrixFilter.html" target="_blank"&gt;ColorMatrixFilter&lt;/a&gt; on the &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/primitives/BitmapImage.html" target="_blank"&gt;BitmapImage&lt;/a&gt; which converts the color image into grayscale.&lt;br /&gt;&lt;br /&gt;To illustrate this, I've created 6 examples:&lt;ol&gt;&lt;li&gt;Normal color image&lt;/li&gt;&lt;li&gt;Color image turned into grayscale using the &lt;b&gt;blendMode="luminosity"&lt;/b&gt; property&lt;/li&gt;&lt;li&gt;Color image turned into grayscale using a &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/filters/ColorMatrixFilter.html" target="_blank"&gt;ColorMatrixFilter&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Combination of a grayscale image (as the background) with part of the color image as the foreground.  To draw only part of the color image, set the &lt;b&gt;fillMode="clip"&lt;/b&gt; property on the image, and then set the &lt;b&gt;width&lt;/b&gt; and &lt;b&gt;height&lt;/b&gt; properties and then the image will be clipped.&lt;/li&gt;&lt;li&gt;A custom &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/ProgressBar.html" target="_blank"&gt;ProgressBar&lt;/a&gt;&lt;/li&gt;&lt;li&gt;A sample non-interactive rating control, as well as some luminosity examples&lt;/li&gt;&lt;/ol&gt;For more information on making skins for progress bars, see these two articles:&lt;br /&gt;&lt;a href="http://blog.flexexamples.com/2010/04/13/creating-a-custom-track-skin-on-an-mx-progressbar-control-in-flex-4/" target="_blank"&gt;Creating a Custom Track Skin on an MX ProgressBar&lt;/a&gt; and &lt;a href="http://blog.flexexamples.com/2010/04/13/creating-a-custom-bar-skin-on-an-mx-progressbar-control-in-flex-4/" target="_blank"&gt;Creating a Custom Bar Skin on an MX ProgressBar&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;And finally, here are the examples. As always right click to view the source code.&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex4/grayscale/GrayscaleApp.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="580" height="765"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;The rating control in example #6 actually uses a Star graphic that is drawn with &lt;a href="http://opensource.adobe.com/wiki/display/flexsdk/FXG+2.0+Specification"&gt;FXG&lt;/a&gt; (Adobe help on &lt;a href="http://help.adobe.com/en_US/flex/using/WSda78ed3a750d6b8f26c150d412357de3591-8000.html"&gt;Using FXG&lt;/a&gt;).  You could just as easily do this in MXML or simply use an image from your computer.  I've noticed that Flash Builder doesn't really support FXG files properly (no autocomplete or new file wizards), so it's not that easy to create them unless you know the specifications well.&lt;br /&gt;&lt;br /&gt;The rating control could easily be extended to be a fully functional user interactive rating control.  You could also use the technique shown in example #4 to display fractional rating values (e.g. 2.5 out of 5).&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-3078621490827209957?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/3078621490827209957/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=3078621490827209957&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/3078621490827209957'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/3078621490827209957'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2011/01/grayscale-images-progressbar-rating.html' title='Grayscale Images, ProgressBar, Rating Control'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-5317150185826135976</id><published>2010-12-22T10:30:00.000-08:00</published><updated>2012-01-27T15:36:51.938-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='3D'/><category scheme='http://www.blogger.com/atom/ns#' term='drawTriangles'/><title type='text'>Drawing 3D Shapes in Flex</title><content type='html'>I found this great 3-part article by &lt;b&gt;Lee Burrows&lt;/b&gt; on how to draw semi 3D shapes in Flex:&lt;br /&gt;&lt;li&gt;&lt;a href="http://blog.leeburrows.com/2010/10/drawtriangles1/" target="_blank"&gt;Part 1&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://blog.leeburrows.com/2010/11/drawtriangles2/" target="_blank"&gt;Part 2&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://blog.leeburrows.com/2010/11/drawtriangles3/" target="_blank"&gt;Part 3&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;I highly recommend that you check them out.  &lt;br /&gt;&lt;br /&gt;Expanding on those examples I've changed them slightly in the following ways:&lt;br /&gt;&lt;li&gt;Instead of rotating the shape based on mouse position, the rotation now happens when you drag your mouse&lt;/li&gt;&lt;li&gt;Added a 3D Triangle and a 3D Arrow (combines a triangle and a cube)&lt;/li&gt;&lt;li&gt;Added a 3D shape with 6 different hockey logos, one on each side&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;All credit goes to Lee for his excellent examples.  If you want to understand the math behind it all, then definitely read his article.  My examples don't have much in the way of comments.&lt;br /&gt;&lt;br /&gt;View Source is available for all the following examples, right click below to access the source.&lt;br /&gt;&lt;table border="0"&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;Example #1 - Simple Rotating Cube:&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex4/flex3D/Flex3D.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="350" height="360"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;Example #2 - Rotating Triangle:&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex4/flex3D/Flex3DTriangle.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="350" height="360"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;Example #3 - Rotating Arrow (with highlighting):&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex4/flex3D/Flex3DArrow.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="350" height="360"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;Example #4 - Cube With Image/Bitmap Fill:&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex4/flex3D/Flex3DBitmap.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="350" height="360"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;You might notice a few tiny problems with the arrow.  When rotating it in certain directions some lines show through that shouldn't be visible.  It is most likely due to combining the two shapes (one cube and one triangle) to form the arrow.&lt;br /&gt;&lt;br /&gt;Also, the mouse dragging to rotate works as expected until you've rotated the shape 180 degrees, then it becomes backwards.  I haven't spent the time to try and fix this.&lt;br /&gt;&lt;br /&gt;The fourth example uses Lee's &lt;b&gt;Shape3D&lt;/b&gt; class which encapsulates the 3D functionality in one simple class.  It is much cleaner this way.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-5317150185826135976?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/5317150185826135976/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=5317150185826135976&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/5317150185826135976'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/5317150185826135976'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2010/12/drawing-3d-shapes-in-flex.html' title='Drawing 3D Shapes in Flex'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-544912471516590911</id><published>2010-11-25T17:27:00.000-08:00</published><updated>2012-01-27T15:34:05.846-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='video'/><category scheme='http://www.blogger.com/atom/ns#' term='embed'/><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>YouTube Videos in Flex</title><content type='html'>Here is an example of how to get YouTube videos to be shown inside your Flex Application.&lt;br /&gt;&lt;br /&gt;The first thing to do is add an &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/SWFLoader.html" target="_blank"&gt;SWFLoader&lt;/a&gt; to your mxml file.  The &lt;b&gt;source&lt;/b&gt; property of the &lt;b&gt;SWFLoader&lt;/b&gt; gets set to the url of the video that you want to show inside Flex.  &lt;br /&gt;&lt;b&gt;But&lt;/b&gt; you can't just use any YouTube url like this one: &lt;br /&gt;&lt;div class="code"&gt;http://www.youtube.com/watch?v=owGykVbfgUE&lt;/div&gt;Instead you use a url in this form: &lt;br /&gt;&lt;div class="code"&gt;&lt;b&gt;&lt;font color="#663300"&gt;http://www.youtube.com/v/VIDEO_ID?version=3&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;The id of the video you want to play (e.g. &lt;b&gt;owGykVbfgUE&lt;/b&gt;) must replace the VIDEO_ID portion of the url.  This url actually redirects to an SWF file somewhere.&lt;br /&gt;&lt;br /&gt;The &lt;b&gt;version=3&lt;/b&gt; parameter is very important.  This tells YouTube to load the &lt;b&gt;ActionScript 3.0&lt;/b&gt; version of the SWF file.  Without this parameter it defaults to the AS2 version which doesn't not play nicely with AS3.  I found that I could watch one video, but after that no other videos could be played (I found this &lt;a href="http://apiblog.youtube.com/2009/01/flex-embedded-player-christmas-story.html" target="_blank"&gt;blog post&lt;/a&gt; that explains why if you're interested).  I also found this &lt;a href="http://code.google.com/apis/youtube/flash_api_reference.html" target="_blank"&gt;YouTube reference&lt;/a&gt; which is where I learned about using the &lt;b&gt;version=3&lt;/b&gt; parameter.&lt;br /&gt;&lt;br /&gt;There are a few other parameters that you can use like:&lt;ul&gt;&lt;li&gt;&lt;b&gt;autoplay=1&lt;/b&gt; - starts the video immediately without the user having to press play&lt;/li&gt;&lt;li&gt;&lt;b&gt;fs=1&lt;/b&gt; - allows full screen&lt;/li&gt;&lt;li&gt;&lt;b&gt;rel=1&lt;/b&gt; - shows related content after the video has finished playing&lt;/li&gt;&lt;/ul&gt;For a full list of the parameters go &lt;a href="http://code.google.com/apis/youtube/player_parameters.html" target="_blank"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;And finally, when you want to play another video, make sure you call the &lt;b&gt;swfLoader.unloadAndStop()&lt;/b&gt; function otherwise you can get multiple videos playing at the same time, very confusing.&lt;br /&gt;&lt;br /&gt;Keep in mind that when you run this locally you will see a lot of &lt;b&gt;SecurityExceptions&lt;/b&gt; in your console, this is expected and normal.  &lt;br /&gt;&lt;br /&gt;And one last thing, some videos you will not be able to play inside Flex due to copyright restrictions.  The owners of youtube videos must be able to specify whether the video can be played from a different website using an embedded player.&lt;br /&gt;&lt;br /&gt;Here is the example in action (right click to view-source):&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex4/youtube/YouTubeVideo.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="690" height="490"&gt;&lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-544912471516590911?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/544912471516590911/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=544912471516590911&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/544912471516590911'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/544912471516590911'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2010/11/youtube-videos-in-flex.html' title='YouTube Videos in Flex'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-6167692793614266938</id><published>2010-10-27T13:18:00.000-07:00</published><updated>2010-10-27T13:36:34.599-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='htmlText'/><category scheme='http://www.blogger.com/atom/ns#' term='Spark Html'/><category scheme='http://www.blogger.com/atom/ns#' term='html tags'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><title type='text'>Displaying Html text in Labels</title><content type='html'>Displaying html content inside Flex labels is not as straight forward as it was in Flex 3 by simply setting the &lt;b&gt;htmlText&lt;/b&gt; property.  Here are the 3 Spark controls used for displaying text:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/Label.html"&gt;Label&lt;/a&gt; - lightweight plain text only&lt;/li&gt;&lt;li&gt;&lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/RichText.html"&gt;RichText&lt;/a&gt; - as the name says it provides support for rich text.&lt;br /&gt;Also allows html content to be imported (anchor tags &amp;lt;a&amp;gt; don't work)&lt;/li&gt;&lt;li&gt;&lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/RichEditableText.html"&gt;RichEditableText&lt;/a&gt; - provides the same rich text support as the RichText control.&lt;br&gt;Allows editing and anchor html tags work properly&lt;/li&gt;&lt;/ul&gt;Here is a list of the &lt;a href="http://help.adobe.com/en_US/flex/using/WS02f7d8d4857b1677-165a04e1126951a2d98-7ff6.html" target="_blank"&gt;supported HTML tags&lt;/a&gt;: &lt;font color="A62424"&gt;&amp;lt;div&amp;gt;, &amp;lt;p&amp;gt;, &amp;lt;a&amp;gt;, &amp;lt;span&amp;gt;, &amp;lt;img&amp;gt;, &amp;lt;br&amp;gt;&lt;/font&gt;.&lt;br /&gt;&lt;br /&gt;As noted above, if you want to use anchor &lt;b&gt;&amp;lt;a&amp;gt;&lt;/b&gt; tags, you must use a &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/RichEditableText.html"&gt;RichEditableText&lt;/a&gt; control.  In this case you'd most likely want to also set the &lt;b&gt;editable="false"&lt;/b&gt; property.&lt;br&gt;The anchor &lt;b&gt;href&lt;/b&gt; property can be set to a relative path like&lt;div class="code"&gt;&amp;lt;a href="index.html"&amp;gt;index&amp;lt;/a&amp;gt;&lt;/div&gt;Or an absolute one like&lt;div class="code"&gt;&amp;lt;a href="http://google.com" target="_blank"&amp;gt;google&amp;lt;/a&amp;gt;&lt;/div&gt;Note that you can set the &lt;b&gt;target&lt;/b&gt; property to control whether the link is opened in a new window or not.&lt;br /&gt;If you want to listen for when the user clicks on an anchor it is possible, but involves a lot more work.  Basically you import the html string into a &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flashx/textLayout/elements/TextFlow.html"&gt;TextFlow&lt;/a&gt; object.  Then you iterate through all the child elements until you find the &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flashx/textLayout/elements/LinkElement.html"&gt;LinkElement&lt;/a&gt; (which represents the anchor tag), and then add a &lt;b&gt;FlowElementMouseEvent.CLICK&lt;/b&gt; event listener.&lt;br /&gt;&lt;br /&gt;Here is some sample code that I use to achieve this:&lt;br /&gt;&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;&lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#3f5fbf"&gt;/**&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;*&amp;nbsp;Converts&amp;nbsp;the&amp;nbsp;html&amp;nbsp;string&amp;nbsp;(from&amp;nbsp;the&amp;nbsp;resources)&amp;nbsp;into&amp;nbsp;a&amp;nbsp;TextFlow&amp;nbsp;object&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;*&amp;nbsp;using&amp;nbsp;the&amp;nbsp;TextConverter&amp;nbsp;class.&amp;nbsp;Then&amp;nbsp;it&amp;nbsp;iterates&amp;nbsp;through&amp;nbsp;all&amp;nbsp;the&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;*&amp;nbsp;elements&amp;nbsp;in&amp;nbsp;the&amp;nbsp;TextFlow&amp;nbsp;until&amp;nbsp;it&amp;nbsp;finds&amp;nbsp;a&amp;nbsp;LinkElement,&amp;nbsp;and&amp;nbsp;adds&amp;nbsp;a&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;*&amp;nbsp;FlowElementMouseEvent.CLICK&amp;nbsp;event&amp;nbsp;handler&amp;nbsp;to&amp;nbsp;that&amp;nbsp;Link&amp;nbsp;Element.&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;*/&lt;/font&gt;&lt;br/&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;public&amp;nbsp;static&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;addLinkClickHandler&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;html:String,&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;linkClickedHandler:Function&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;:TextFlow&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;textFlow:TextFlow&amp;nbsp;=&amp;nbsp;TextConverter.importToFlow&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;html,&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;TextConverter.TEXT_FIELD_HTML_FORMAT&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;link:LinkElement&amp;nbsp;=&amp;nbsp;findLinkElement&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;textFlow&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;if&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;link&amp;nbsp;!=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&amp;nbsp;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;link.addEventListener&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;FlowElementMouseEvent.CLICK,&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;linkClickedHandler,&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;false&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;true&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;else&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;trace&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;Warning&amp;nbsp;-&amp;nbsp;couldn't&amp;nbsp;find&amp;nbsp;link&amp;nbsp;tag&amp;nbsp;in:&amp;nbsp;&amp;#34;&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;+&amp;nbsp;html&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;return&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;textFlow;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;&lt;br/&gt;&lt;font color="#3f5fbf"&gt;/**&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;*&amp;nbsp;Finds&amp;nbsp;the&amp;nbsp;first&amp;nbsp;LinkElement&amp;nbsp;recursively&amp;nbsp;and&amp;nbsp;returns&amp;nbsp;it.&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;*/&lt;/font&gt;&lt;br/&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;private&amp;nbsp;static&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;findLinkElement&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;group:FlowGroupElement&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;:LinkElement&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;childGroups:Array&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;[]&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;First&amp;nbsp;check&amp;nbsp;all&amp;nbsp;the&amp;nbsp;child&amp;nbsp;elements&amp;nbsp;of&amp;nbsp;the&amp;nbsp;current&amp;nbsp;group,&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;Also&amp;nbsp;save&amp;nbsp;any&amp;nbsp;children&amp;nbsp;that&amp;nbsp;are&amp;nbsp;FlowGroupElement&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;for&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;i:int&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;;&amp;nbsp;i&amp;nbsp;&amp;lt;&amp;nbsp;group.numChildren;&amp;nbsp;i++&lt;/font&gt;&lt;font color="#000000"&gt;)&amp;nbsp;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;element:FlowElement&amp;nbsp;=&amp;nbsp;group.getChildAt&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;i&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;if&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;element&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;is&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;LinkElement&lt;/font&gt;&lt;font color="#000000"&gt;)&amp;nbsp;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;return&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;element&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;as&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;LinkElement&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;else&amp;nbsp;if&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;element&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;is&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;FlowGroupElement&lt;/font&gt;&lt;font color="#000000"&gt;)&amp;nbsp;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;childGroups.push&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;element&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;Recursively&amp;nbsp;check&amp;nbsp;the&amp;nbsp;child&amp;nbsp;FlowGroupElements&amp;nbsp;now&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;for&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;i&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;;&amp;nbsp;i&amp;nbsp;&amp;lt;&amp;nbsp;childGroups.length;&amp;nbsp;i++&lt;/font&gt;&lt;font color="#000000"&gt;)&amp;nbsp;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;childGroup:FlowGroupElement&amp;nbsp;=&amp;nbsp;childGroups&lt;/font&gt;&lt;font color="#000000"&gt;[&lt;/font&gt;&lt;font color="#000000"&gt;i&lt;/font&gt;&lt;font color="#000000"&gt;]&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;link:LinkElement&amp;nbsp;=&amp;nbsp;findLinkElement&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;childGroup&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;if&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;link&amp;nbsp;!=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&amp;nbsp;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;return&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;link;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;return&amp;nbsp;null&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;A simple control that I've created and use frequently is called &lt;b&gt;HtmlLabel&lt;/b&gt; which extends the &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/RichEditableText.html"&gt;RichEditableText&lt;/a&gt; class to provide simple support for html text:&lt;br /&gt;&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;&lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#000000"&gt;&amp;lt;?xml&amp;nbsp;version=&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;1.0&amp;#34;&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;encoding=&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;utf-8&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;?&amp;gt;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;&amp;lt;s:RichEditableText&amp;nbsp;xmlns:fx=&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;http://ns.adobe.com/mxml/2009&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;xmlns:s=&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;library://ns.adobe.com/flex/spark&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;xmlns:mx=&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;library://ns.adobe.com/flex/mx&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;focusEnabled=&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;false&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;selectable=&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;false&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;editable=&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;false&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;&amp;gt;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;&amp;lt;fx:Script&amp;gt;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;&amp;lt;!&lt;/font&gt;&lt;font color="#000000"&gt;[&lt;/font&gt;&lt;font color="#000000"&gt;CDATA&lt;/font&gt;&lt;font color="#000000"&gt;[&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;import&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;flashx.textLayout.conversion.TextConverter;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;override&amp;nbsp;public&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;set&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;text&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;value:String&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;:&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;super&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;.textFlow&amp;nbsp;=&amp;nbsp;TextConverter.importToFlow&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;value,&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;TextConverter.TEXT_FIELD_HTML_FORMAT&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;]]&lt;/font&gt;&lt;font color="#000000"&gt;&amp;gt;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;&amp;lt;/fx:Script&amp;gt;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;&amp;lt;/s:RichEditableText&amp;gt;&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-6167692793614266938?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/6167692793614266938/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=6167692793614266938&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/6167692793614266938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/6167692793614266938'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2010/10/displaying-html-text-in-labels.html' title='Displaying Html text in Labels'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-4722952408687487244</id><published>2010-10-27T09:38:00.000-07:00</published><updated>2012-01-27T15:32:58.071-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='spell check'/><category scheme='http://www.blogger.com/atom/ns#' term='squiggly'/><category scheme='http://www.blogger.com/atom/ns#' term='text area'/><title type='text'>Spell Checking</title><content type='html'>Here is a short example of how to get the &lt;a href="http://labs.adobe.com/technologies/squiggly/"  target="_blank"&gt;Adobe Squiggly&lt;/a&gt; spell checking tool installed. Squiggly can be downloaded &lt;a href="http://labs.adobe.com/technologies/squiggly/" target="_blank"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;Squiggly files&lt;/u&gt;&lt;/b&gt;:&lt;ul&gt;&lt;li&gt;&lt;b&gt;AdobeSpellingConfig.xml&lt;/b&gt; - put this file in your project's &lt;b&gt;src&lt;/b&gt; folder.  It defines the locations of the dictionaries and which language(s) to use.&lt;/li&gt;&lt;li&gt;&lt;b&gt;en_US.aff, en_US.dic&lt;/b&gt; - these are the dictionary files.  You'll need different ones for different languages of course.  By default they go in the &lt;b&gt;src/dictionaries/en_US&lt;/b&gt; folder.&lt;/li&gt;&lt;li&gt;&lt;b&gt;AdobeSpellingEngine.swc&lt;/b&gt; - the main engine library - &lt;b&gt;required&lt;/b&gt;, goes in project lib folder.&lt;/li&gt;&lt;li&gt;&lt;b&gt;AdobeSpellingUI.swc&lt;/b&gt; - the ui library for &lt;b&gt;Flex 3/MX components&lt;/b&gt; (e.g. &amp;lt;mx:TextArea&amp;gt;)&lt;/li&gt;&lt;li&gt;&lt;b&gt;AdobeSpellingUIEx.swc&lt;/b&gt; - the ui library for &lt;b&gt;Flex 4/Spark components&lt;/b&gt; (e.g. &amp;lt;s:TextArea&amp;gt;)&lt;/li&gt;&lt;/ul&gt;&lt;b&gt;&lt;font color="#A62424"&gt;** Only use one of &lt;u&gt;AdobeSpellingUI.swc&lt;/u&gt; or &lt;u&gt;AdobeSpellingUIEx.swc&lt;/u&gt;&lt;/font&gt;&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;To integrate Spell Checking into a &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/TextArea.html" target="_blank"&gt;Spark TextArea&lt;/a&gt; (id="textArea"), all you have to do is add one line:&lt;br /&gt;&lt;br /&gt;&lt;div class="code"&gt;SpellUI.enableSpelling(textArea, &lt;font color="A62424"&gt;&lt;b&gt;"en_US"&lt;/b&gt;&lt;/font&gt;);&lt;/div&gt;&lt;br /&gt;I did notice one problem with using Squiggly with Spark controls.  The default &lt;font color="#336699"&gt;Cut/Copy/Paste/Select All&lt;/font&gt; context menu items were not available anymore.  I found a workaround for this by getting the contextMenu (which gets set on the &lt;b&gt;RichEditableText&lt;/b&gt; control, not the TextArea) and setting &lt;b&gt;clipboardMenu = true&lt;/b&gt;.  See the example below for more details (right click to View Source).  &lt;br /&gt;&lt;br /&gt;Squiggly is still in prerelease, so a few bugs are expected. There is a forum &lt;a href="http://forums.adobe.com/community/labs/squiggly" target="_blank"&gt;here&lt;/a&gt; for discussions on Squiggly, and to report problems.&lt;br /&gt;&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex4/squiggly/SquigglyTest.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="280" height="130"&gt;&lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-4722952408687487244?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/4722952408687487244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=4722952408687487244&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/4722952408687487244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/4722952408687487244'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2010/10/spell-checking.html' title='Spell Checking'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-9099594946628711393</id><published>2010-09-09T18:15:00.000-07:00</published><updated>2012-01-27T15:32:08.309-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Lines'/><category scheme='http://www.blogger.com/atom/ns#' term='Tree'/><category scheme='http://www.blogger.com/atom/ns#' term='AdvancedDataGrid'/><category scheme='http://www.blogger.com/atom/ns#' term='spark'/><title type='text'>Flex 4 Tree Lines</title><content type='html'>I've updated my previous blog post on &lt;a href="http://flexdevtips.blogspot.com/2009/04/tree-lines.html"&gt;Tree Lines&lt;/a&gt; to include a Flex 4/Spark version which uses the MXTreeItemRenderer class.&lt;br /&gt;&lt;br /&gt;For more documentation on how to use it see the blog post linked above.&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex4/treelines/TreeLinesTest.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="570" height="300"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;I've also updated the AdvancedDataGrid example to show tree lines in the tree:&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex4/treelines/TreeLinesADGTest.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="630" height="415"&gt;&lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-9099594946628711393?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/9099594946628711393/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=9099594946628711393&amp;isPopup=true' title='13 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/9099594946628711393'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/9099594946628711393'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2010/09/flex-4-tree-lines.html' title='Flex 4 Tree Lines'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>13</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-1510049568390436138</id><published>2010-08-27T17:04:00.000-07:00</published><updated>2012-01-27T15:31:16.752-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='height'/><category scheme='http://www.blogger.com/atom/ns#' term='browser'/><title type='text'>Detecting browser height</title><content type='html'>Here is an example of one way to find out the &lt;b&gt;height&lt;/b&gt; of the browser window from inside Flex.  It is very easy to find this out if your have your Flex application set to &lt;b&gt;height="100%"&lt;/b&gt;.  But if you use a fixed height like &lt;b&gt;height="300"&lt;/b&gt; then &lt;b&gt;stage.stageHeight&lt;/b&gt; and &lt;b&gt;app.height&lt;/b&gt; both return 300.  &lt;br /&gt;&lt;br /&gt;This example uses the &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html?filter_flex=4.1&amp;filter_flashplayer=10.1&amp;filter_air=2"&gt;ExternalInterface&lt;/a&gt; to determine the height of the browser by calling the &lt;b&gt;eval&lt;/b&gt; javascript function (it is a built-in function).  &lt;br /&gt;&lt;br /&gt;E.g. &lt;div class="code"&gt;&lt;font color="#689BCC"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/font&gt; browserHeight:Number = ExternalInterface.call(&lt;font color="#990000"&gt;&lt;b&gt;"eval"&lt;/b&gt;&lt;/font&gt;, &lt;font color="#990000"&gt;&lt;b&gt;"window.innerHeight"&lt;/b&gt;&lt;/font&gt;);&lt;/div&gt;&lt;br /&gt;Different browsers (NS, FF, Chrome, IE, Safari) obviously don't all support this call.  So far the &lt;b&gt;window.innerHeight&lt;/b&gt; property works on all of them except IE.  For IE you can use this one (IE 7 and above I think?):&lt;div class="code"&gt;&lt;font color="#689BCC"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/font&gt; browserHeight:Number = ExternalInterface.call(&lt;font color="#990000"&gt;&lt;b&gt;"eval"&lt;/b&gt;&lt;/font&gt;, &lt;font color="#990000"&gt;&lt;b&gt;"document.documentElement.clientHeight"&lt;/b&gt;&lt;/font&gt;);&lt;/div&gt;&lt;br /&gt;And if your browser is older you can try this one:&lt;div class="code"&gt;&lt;font color="#689BCC"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/font&gt; browserHeight:Number = ExternalInterface.call(&lt;font color="#990000"&gt;&lt;b&gt;"eval"&lt;/b&gt;&lt;/font&gt;, &lt;font color="#990000"&gt;&lt;b&gt;"document.getElementsByTagName('body')[0].clientHeight"&lt;/b&gt;&lt;/font&gt;);&lt;/div&gt;&lt;br /&gt;Browsers will also handle errors differently, so if you try to use one of those JavaScript functions in one browser you might get &lt;b&gt;undefined&lt;/b&gt; return, and in another browser you might get an error dialog box.&lt;br /&gt;&lt;br /&gt;Here is an example of this in action, it opens in a new browser window to show it properly.&lt;br /&gt;If it was embedded on this page using an &lt;b&gt;&amp;lt;iframe&amp;gt;&lt;/b&gt; tag then the size returned is that of the iframe, not the browser.  &lt;br /&gt;&lt;br /&gt;&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex4/browserheight/BrowserHeight.html" style="font-size:16;font-weight:bold;color:#990000" target="_blank"&gt; - Browser Height Example - &lt;br /&gt;&lt;img src="http://chris.firlingcanada.com/flexdevtips/flex4/browserheight/screenshot.png" border="1" alt="Click this image to open the real application" title="Click this image to open the real application"/&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Obviously if you were interested in the browser width then you could do exactly the same thing but replace &lt;b&gt;innerHeight&lt;/b&gt; with &lt;b&gt;innerWidth&lt;/b&gt; and &lt;b&gt;clientHeight&lt;/b&gt; with &lt;b&gt;clientWidth&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;Comments welcome.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-1510049568390436138?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/1510049568390436138/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=1510049568390436138&amp;isPopup=true' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/1510049568390436138'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/1510049568390436138'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2010/08/detecting-browser-height.html' title='Detecting browser height'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-507723810548400394</id><published>2010-08-11T15:36:00.000-07:00</published><updated>2012-01-27T15:30:11.791-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='synchronized'/><category scheme='http://www.blogger.com/atom/ns#' term='textarea'/><category scheme='http://www.blogger.com/atom/ns#' term='list'/><category scheme='http://www.blogger.com/atom/ns#' term='scrollbar'/><category scheme='http://www.blogger.com/atom/ns#' term='scroller'/><title type='text'>Synchronized Scrollbars</title><content type='html'>I recently had a need for two side-by-side &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/TextArea.html?allClasses=1"&gt;TextArea&lt;/a&gt;s whose vertical scrollbars were synchronized.  So if you drag the left scrollbar, the right one updates, and vice versa.  &lt;br /&gt;&lt;br /&gt;I've written a utility class called &lt;b&gt;LinkedScrollers&lt;/b&gt; that synchronizes the scrolling of two &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/Scroller.html?allClasses=1"&gt;Scroller&lt;/a&gt;s.  It has 5 public properties:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;enabled&lt;/b&gt; (defaults to true) - set to false to allow scrollbars to move independently&lt;/li&gt;&lt;li&gt;&lt;b&gt;scroller1&lt;/b&gt; - the first Scroller&lt;/li&gt;&lt;li&gt;&lt;b&gt;scroller2&lt;/b&gt; - the second Scroller&lt;/li&gt;&lt;li&gt;&lt;b&gt;component1&lt;/b&gt; - the first &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/supportClasses/SkinnableComponent.html?allClasses=1"&gt;SkinnableComponent&lt;/a&gt;, e.g. &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/List.html?allClasses=1"&gt;List&lt;/a&gt;, &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/TextArea.html?allClasses=1"&gt;TextArea&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;component2&lt;/b&gt; - the second SkinnableComponent (List, TextArea, etc)&lt;/li&gt;&lt;/ul&gt;Originally I wanted to bind the scrollers directly to my &lt;b&gt;LinkedScrollers&lt;/b&gt; in MXML like this:&lt;div class="code"&gt;&lt;b&gt;&amp;lt;spark:LinkedScrollers scroller1="{list.scroller}" scroller2="{textArea.scroller}"/&amp;gt;&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;But unfortunately the &lt;b&gt;scroller&lt;/b&gt; property on List/TextArea is not bindable, so that didn't work.  You can still use the &lt;b&gt;scroller1&lt;/b&gt; and &lt;b&gt;scroller2&lt;/b&gt; in ActionScript (e.g. in the application's creationComplete handler) to set the scrollers.&lt;br /&gt;&lt;br /&gt;So another solution is to set the &lt;b&gt;component1&lt;/b&gt; and &lt;b&gt;component2&lt;/b&gt; properties to the two SkinnableComponents that you want to link (Lists, TextAreas, etc).  It should work for any SkinnableComponent that contains a &lt;b&gt;"scroller"&lt;/b&gt; skin part. &lt;br /&gt;E.g.&lt;div class="code"&gt;&lt;b&gt;&amp;lt;spark:LinkedScrollers component1="{list}" component2="{textArea}"/&amp;gt;&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Here it is in action, view source enabled (right click on the example below):&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex4/synchronizedscrollers/SynchronizedScrollersApp.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="240" height="250"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;As you might guess, this follows on from my previous post on &lt;a href="http://flexdevtips.blogspot.com/2010/07/spark-textarea-with-line-numbers.html"&gt;Spark TextArea With Line Numbers&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-507723810548400394?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/507723810548400394/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=507723810548400394&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/507723810548400394'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/507723810548400394'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2010/08/synchronized-scrollers.html' title='Synchronized Scrollbars'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-2333051573117473117</id><published>2010-07-16T10:46:00.000-07:00</published><updated>2012-01-27T15:29:05.793-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='line numbers'/><category scheme='http://www.blogger.com/atom/ns#' term='textarea'/><category scheme='http://www.blogger.com/atom/ns#' term='spark'/><title type='text'>Spark TextArea with Line Numbers</title><content type='html'>Here is a skin that you can use on the Spark &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/TextArea.html?allClasses=1"&gt;TextArea&lt;/a&gt; class to show line numbers down the left side of the text.&lt;br /&gt;The line numbers use the same size font as the TextArea.&lt;br /&gt;&lt;br /&gt;It is very simply to use, simply set the &lt;b&gt;skinClass&lt;/b&gt; property in mxml like this:&lt;br /&gt;&lt;div class="code"&gt;&lt;font color="#0000FF"&gt;&amp;lt;s:TextArea&lt;/font&gt; skinClass="&lt;font color="#990000"&gt;flex.utils.spark.TextAreaLineNumbersSkin&lt;/font&gt;"&lt;font color="#0000FF"&gt;/&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;If you want a horizontal scroll bar on the TextArea, then set &lt;b&gt;lineBreak="explicit"&lt;/b&gt; and the horizontal scrollbar will appear.&lt;br /&gt;&lt;br /&gt;Here is an example of it in action (right click to view source).&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex4/textarealinenumbers/TextAreaLineNumbersTest.html?v=1.1.1" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="380" height="355"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;It would be very easy to modify this skin to make it resizable by adding a resize handle in the bottom right corner.  Look at the source code from my previous blog post on &lt;a href="http://flexdevtips.blogspot.com/2010/06/flex-4-spark-resizable-controls.html"&gt;Resizable Controls&lt;/a&gt;, specifically the &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex4/resizablecontrols/srcview/source/flex/utils/spark/resize/ResizableTextAreaSkin.mxml.html"&gt;flex.utils.spark.resize.ResizableTextAreaSkin&lt;/a&gt; class, it uses a custom skin for the &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/Scroller.html?allClasses=1"&gt;Scroller&lt;/a&gt;, which adds the resize handle.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-2333051573117473117?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/2333051573117473117/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=2333051573117473117&amp;isPopup=true' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/2333051573117473117'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/2333051573117473117'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2010/07/spark-textarea-with-line-numbers.html' title='Spark TextArea with Line Numbers'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-5722342734813467634</id><published>2010-06-28T16:48:00.000-07:00</published><updated>2012-01-27T15:27:02.249-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='resizable controls'/><category scheme='http://www.blogger.com/atom/ns#' term='spark'/><category scheme='http://www.blogger.com/atom/ns#' term='scroller'/><title type='text'>Flex 4 Spark Resizable Controls</title><content type='html'>Please go here for &lt;a href="http://flexdevtips.blogspot.com/2009/03/resizable-containers.html"&gt;Flex 3 Resizable Containers&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I've created a bunch of skins for many of the common Spark components that allows them to be resized.  Each of these skins contains a &lt;b&gt;resizeHandle&lt;/b&gt; that when dragged allows the control to be resized.  There are two resize handle classes that you can use, the default is called &lt;b&gt;flex.utils.spark.resize.ResizeHandleLines&lt;/b&gt;.  You can replace every occurrence of that class with &lt;b&gt;flex.utils.spark.resize.ResizeHandleDots&lt;/b&gt; if you prefer.&lt;br /&gt;&lt;br /&gt;Here are a list of resize skins:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex4/resizablecontrols/srcview/source/flex/utils/spark/resize/ResizableTextAreaSkin.mxml.html"&gt;ResizableTextAreaSkin&lt;/a&gt; (skin for &lt;a href=http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/TextArea.html?allClasses=1"&gt;spark.components.TextArea&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex4/resizablecontrols/srcview/source/flex/utils/spark/resize/ResizableDropDownListSkin.mxml.html"&gt;ResizableDropDownListSkin&lt;/a&gt; (skin for &lt;a href=http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/DropDownList.html?allClasses=1"&gt;spark.components.DropDownList&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex4/resizablecontrols/srcview/source/flex/utils/spark/resize/ResizableComboBoxSkin.mxml.html"&gt;ResizableComboBoxSkin&lt;/a&gt; (skin for &lt;a href=http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/ComboBox.html?allClasses=1"&gt;spark.components.ComboBox&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex4/resizablecontrols/srcview/source/flex/utils/spark/resize/ResizablePanelSkin.mxml.html"&gt;ResizablePanelSkin&lt;/a&gt; (skin for &lt;a href=http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/Panel.html?allClasses=1"&gt;spark.components.Panel&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex4/resizablecontrols/srcview/source/flex/utils/spark/resize/ResizableTitleWindowSkin.mxml.html"&gt;ResizableTitleWindowSkin&lt;/a&gt; (skin for &lt;a href=http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/TitleWindow.html?allClasses=1"&gt;spark.components.TitleWindow&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex4/resizablecontrols/srcview/source/flex/utils/spark/resize/ResizableDraggableTitleWindowSkin.mxml.html"&gt;ResizableDraggableTitleWindowSkin&lt;/a&gt; (&lt;i&gt;draggable&lt;/i&gt; skin for &lt;a href=http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/TitleWindow.html?allClasses=1"&gt;spark.components.TitleWindow&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex4/resizablecontrols/srcview/source/flex/utils/spark/resize/ResizableScrollerSkin.mxml.html"&gt;ResizableScrollerSkin&lt;/a&gt; (skin for &lt;a href=http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/Scroller.html?allClasses=1"&gt;spark.components.Scroller&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex4/resizablecontrols/srcview/source/flex/utils/spark/resize/ResizableTitledBorderBoxSkin.mxml.html"&gt;ResizableTitledBorderBoxSkin&lt;/a&gt; (skin for &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex4/resizablecontrols/srcview/source/flex/utils/spark/TitledBorderBox.as.html"&gt;flex.utils.spark.TitledBorderBox&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex4/resizablecontrols/srcview/source/flex/utils/spark/resize/ResizableLabel.as.html"&gt;ResizableLabel&lt;/a&gt; (extends &lt;a href=http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/Label.html?allClasses=1"&gt;spark.components.Label&lt;/a&gt;, not a skin)&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;With the exception of the &lt;b&gt;ResizableLabel&lt;/b&gt; class, all the others are Skins, and as such can be used very simply by setting the &lt;b&gt;skinClass="flex.utils.spark.resize.___Skin"&lt;/b&gt; property to the appropriate skin.&lt;br /&gt;&lt;br /&gt;Another option is to create a CSS style for &lt;b&gt;ALL&lt;/b&gt; &lt;a href=http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/Scroller.html?allClasses=1"&gt;spark.components.Scroller&lt;/a&gt; classes to use the &lt;b&gt;flex.utils.spark.resize.ResizableScrollerSkin&lt;/b&gt; class like this:&lt;br /&gt;&lt;div class="code"&gt;&lt;font color="#0000ff"&gt;&amp;lt;fx:Style&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;font color="#646464"&gt;@namespace&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;s&amp;nbsp;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;library://ns.adobe.com/flex/spark&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#646464"&gt;@namespace&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;mx&amp;nbsp;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;library://ns.adobe.com/flex/mx&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#646464"&gt;@namespace&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;spark&amp;nbsp;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;flex.utils.spark.*&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#646464"&gt;@namespace&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;resize&amp;nbsp;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;flex.utils.spark.resize.*&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;&lt;br /&gt;&lt;font color="#009900"&gt;/*&amp;nbsp;Make&amp;nbsp;all&amp;nbsp;Scroller's&amp;nbsp;use&amp;nbsp;the&amp;nbsp;resizable&amp;nbsp;scroller&amp;nbsp;skin.&amp;nbsp;*/&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;s|Scroller&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#9900cc"&gt;&lt;b&gt;skin-class&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;:&amp;nbsp;ClassReference&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;flex.utils.spark.resize.ResizableScrollerSkin&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;}&amp;nbsp;&lt;/font&gt;&lt;br /&gt;&lt;font color="#0000ff"&gt;&amp;lt;/fx:Style&amp;gt;&lt;/font&gt;&lt;/code&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;**&lt;/b&gt; Note that I've renamed the Flex3 package &lt;b&gt;flex.utils.ui.resize.*&lt;/b&gt; to the new Flex4/Spark package name &lt;b&gt;flex.utils.spark.resize.*&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;The most used skin is the &lt;b&gt;ResizableScrollerSkin&lt;/b&gt;, it is used on TextAreas, Lists, DataGrids, Trees, ComboBoxes, DropDownLists, and anything else that uses a &lt;b&gt;Scroller&lt;/b&gt; component.  The way it works is to use a skin for the Scroller that adds the resize handle and uses custom &lt;b&gt;HScrollBar&lt;/b&gt; and &lt;b&gt;VScrollBar&lt;/b&gt; classes which leave room for the resize handle (the simplest way I could think to do it).  Each of the resizable skins uses the &lt;b&gt;ResizeManager&lt;/b&gt; class to handle the mouse events and resize the appropriate control.&lt;br /&gt;&lt;br /&gt;The resizable ComboBox and DropDownList skins are slightly different in that they both save the size of the drop down list since it gets destroyed and re-created each time.  It also sets the &lt;b&gt;popUpWidthMatchesAnchorWidth="false"&lt;/b&gt; after resizing since the width no longer matches the anchor.&lt;br /&gt;&lt;br /&gt;I've also added support for restricting the resize in only the vertical or horizontal direction.  There are many ways you can do this, you can either set a style on the resize component:&lt;br /&gt;&lt;div class="code"&gt;.resizePanel {&lt;br /&gt;&amp;nbsp;&amp;nbsp;resize-direction: vertical; /* or horizontal */&lt;br /&gt;}&lt;br /&gt;&lt;/div&gt;Or you can call a static method on the &lt;b&gt;ResizeManager&lt;/b&gt; class:&lt;br /&gt;&lt;div class="code"&gt;ResizeManager.setResizeDirection(resizePanel, "vertical"); // or "horizontal"&lt;br /&gt;&lt;/div&gt;Or if you can access the ResizeManager class (usually stored in the skin class), then you can set the &lt;b&gt;resizeDirection&lt;/b&gt; property on the manager like this:&lt;br /&gt;&lt;div class="code"&gt;resizeManager.resizeDirection = "vertical"; // or "horizontal";&lt;br /&gt;&lt;/div&gt;There are constants defined in the &lt;b&gt;ResizeManager&lt;/b&gt; class for "vertical", "horizontal", and "both" (default).  &lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;font color="#AA0000"&gt;September 30th, 2010 Update&lt;/font&gt;&lt;/b&gt;:&lt;br /&gt;I've added a new skin called &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex4/resizablecontrols/srcview/source/flex/utils/spark/resize/ResizableDraggableTitleWindowSkin.mxml.html"&gt;ResizableDraggableTitleWindowSkin&lt;/a&gt; that uses the &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex4/resizablecontrols/srcview/source/flex/utils/spark/resize/MoveManager.as.html"&gt;MoveManager&lt;/a&gt; class to allow dragging the TitleWindow around the screen.  It also adds a small drag handle in the titlebar too.&lt;br /&gt;The same could be done for other classes (e.g. Panel) by following the same procedure.  All that is required is a &lt;b&gt;dragComponent&lt;/b&gt; (the component that listens for mouse drag events) and a &lt;b&gt;moveComponent&lt;/b&gt; (the component that gets moved - in this case it is the TitleWindow).&lt;br /&gt;&lt;br /&gt;Here is an example of most of the skins, view-source enabled.&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex4/resizablecontrols/ResizableControls.html?v=1.2.2" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="710" height="710"&gt;&lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-5722342734813467634?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/5722342734813467634/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=5722342734813467634&amp;isPopup=true' title='51 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/5722342734813467634'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/5722342734813467634'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2010/06/flex-4-spark-resizable-controls.html' title='Flex 4 Spark Resizable Controls'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>51</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-952169443148032769</id><published>2010-06-01T14:02:00.000-07:00</published><updated>2012-01-27T15:25:40.974-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='spark'/><category scheme='http://www.blogger.com/atom/ns#' term='titled border'/><title type='text'>TitledBorderBox (Flex 4/Spark)</title><content type='html'>I've re-written my original &lt;a href="http://flexdevtips.blogspot.com/2009/04/titled-border-box.html" target="_blank"&gt;TitledBorderBox&lt;/a&gt; class (Flex 3) to use Spark/Flex 4 components.  It is slightly simpler, and hopefully more lightweight.  It extends the &lt;a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/SkinnableContainer.html?allClasses=1" target="_blank"&gt;SkinnableContainer&lt;/a&gt; class, and uses it's own skin (&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex4/titledborderbox/srcview/source/flex/utils/ui/TitledBorderBoxSkin.mxml.html"&gt;flex.utils.ui.TitledBorderBoxSkin&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;Here are the properties on the component:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;backgroundAlpha&lt;/b&gt; - the background alpha for the box (default: 1)&lt;/li&gt;&lt;li&gt;&lt;b&gt;backgroundColor&lt;/b&gt; - the background color for the box (default: white)&lt;/li&gt;&lt;li&gt;&lt;b&gt;backgroundVisible&lt;/b&gt; - if the background should be shown (default: true)&lt;/li&gt;&lt;li&gt;&lt;b&gt;borderAlpha&lt;/b&gt; - the border alpha for the box (default: 1)&lt;/li&gt;&lt;li&gt;&lt;b&gt;borderColor&lt;/b&gt; - the border color for the box (default: black)&lt;/li&gt;&lt;li&gt;&lt;b&gt;borderWeight&lt;/b&gt; - the thickness of the border (default: 1)&lt;/li&gt;&lt;li&gt;&lt;b&gt;borderVisible&lt;/b&gt; - if the border should be shown (default: true)&lt;/li&gt;&lt;li&gt;&lt;b&gt;cornerRadius&lt;/b&gt; - the corner radius for rounded corners (default: 0)&lt;/li&gt;&lt;li&gt;&lt;b&gt;dropShadowVisible&lt;/b&gt; - if a drop shadow is shown (default: false)&lt;/li&gt;&lt;li&gt;&lt;b&gt;titleStyleName&lt;/b&gt; - the style name for the title label (default "windowStyles")&lt;/li&gt;&lt;li&gt;&lt;b&gt;title&lt;/b&gt; - the title to show in the border&lt;/li&gt;&lt;/ul&gt;It also supports most of the layout properties too as styles (paddingLeft/Right/Top/Bottom, gap/horizontalGap/verticalGap, horizontal/verticalAlign, etc) for convenience.&lt;br /&gt;&lt;br /&gt;The way the border is drawn is to simply draw a line over top of the border, but underneath the title that is the same color as the background.  If you set borderVisible="false", then it will attempt to find the background color of the parent and use that instead.  &lt;br /&gt;&lt;br /&gt;Here it is in action (view source enabled, right click):&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex4/titledborderbox/TitledBorderBoxTest.html?v=1.1" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="485" height="375"&gt;&lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-952169443148032769?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/952169443148032769/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=952169443148032769&amp;isPopup=true' title='16 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/952169443148032769'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/952169443148032769'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2010/06/titledborderbox-flex-4spark.html' title='TitledBorderBox (Flex 4/Spark)'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>16</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-7335753358368321715</id><published>2010-05-14T18:04:00.000-07:00</published><updated>2012-01-27T15:24:14.209-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='highlighting'/><category scheme='http://www.blogger.com/atom/ns#' term='search'/><category scheme='http://www.blogger.com/atom/ns#' term='track'/><category scheme='http://www.blogger.com/atom/ns#' term='textarea'/><category scheme='http://www.blogger.com/atom/ns#' term='list'/><category scheme='http://www.blogger.com/atom/ns#' term='scrollbar'/><title type='text'>Highlight The ScrollBar Track</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_GHE-O4AUOwE/S-3u4bz9TXI/AAAAAAAAA3o/UG1gtavgs7Y/s1600/scrollbar_highlighting.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_GHE-O4AUOwE/S-3u4bz9TXI/AAAAAAAAA3o/UG1gtavgs7Y/s320/scrollbar_highlighting.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;I'm not sure what this feature is called, but have you seen in Google Chrome when you search the current web page for a certain phrase, the vertical scroll bar will be highlighted showing you all the locations of that phrase?  See the screenshot on the right for an example of what I mean. &amp;nbsp;In front of the track, but behind the scrollbar thumb are lines showing you were the search results are located. It's a nice little feature that I find quite helpful.&lt;br /&gt;&lt;br /&gt;I've implemented the same thing in Flex for showing the scrollbar track highlighting when words in a &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/TextArea.html"&gt;TextArea&lt;/a&gt; are highlighted, and when items are selected in a &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/List.html"&gt;List&lt;/a&gt; (it should work for a DataGrid too, but I haven't tested it).&lt;br /&gt;&lt;br /&gt;The nice thing about my implementation is that it is very simple to set up. &amp;nbsp;All you have to do is set the &lt;b&gt;verticalScrollBarStyleName&lt;/b&gt; property on your &lt;b&gt;List&lt;/b&gt;, &lt;b&gt;DataGrid&lt;/b&gt; or &lt;b&gt;TextArea&lt;/b&gt;, and then create your CSS to set the &lt;b&gt;trackSkin&lt;/b&gt; style to one of my two custom skins and it will all work. &lt;br /&gt;E.g.&lt;div class="code"&gt;&lt;font color="#006633"&gt;&amp;lt;mx:Style&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;font color="ff00ff"&gt;.highlightList&lt;/font&gt; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#330099"&gt;track-skin&lt;/font&gt;: &lt;font color="#3333cc"&gt;ClassReference&lt;/font&gt;(&lt;font color="#990000"&gt;"skins.HighlightListScrollTrackSkin"&lt;/font&gt;);&lt;br /&gt;}&lt;br /&gt;&lt;font color="ff00ff"&gt;.highlightTextArea&lt;/font&gt; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#330099"&gt;trackSkin&lt;/font&gt;: &lt;font color="#3333cc"&gt;ClassReference&lt;/font&gt;(&lt;font color="#990000"&gt;"skins.HighlightTextAreaScrollTrackSkin"&lt;/font&gt;);&lt;br /&gt;}&lt;br /&gt;&lt;font color="#006633"&gt;&amp;lt;/mx:Style&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#0000ff"&gt;&amp;lt;mx:List &lt;/font&gt;&lt;font color="#000000"&gt;verticalScrollBarStyleName=&lt;/font&gt;&lt;font color="#990000"&gt;"highlightList"&lt;/font&gt;&lt;font color="#0000ff"&gt;/&amp;gt;&lt;/font&gt;&lt;/div&gt;&lt;br /&gt;The text highlighting in the &lt;b&gt;TextArea&lt;/b&gt; is done using some useful code that I found on this blog:&lt;br /&gt;&lt;a href="http://ntt.cc/2008/07/20/how-to-highlight-the-text-in-flex-with-full-source-code.html" target="_blank"&gt;How to Highlight the Text in Flex&lt;/a&gt;.&lt;br /&gt;I slightly modified the &lt;b&gt;com.components.BlockTextArea&lt;/b&gt; class to make it work with my &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/highlightscrolltrack/srcview/source/skins/HighlightTextAreaScrollTrackSkin.as.html"&gt;skins.HighlightTextAreaScrollTrackSkin&lt;/a&gt; class.&lt;br /&gt;&lt;br /&gt;Here's the example (right click to View Source):&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/highlightscrolltrack/HighlightScrollTrackTest.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="590" height="250"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;You can also set two more styles if you want to customize the color and alpha transparency of the highlighting:&lt;br /&gt;&lt;b&gt;highlight-color&lt;/b&gt; and &lt;b&gt;highlight-alpha&lt;/b&gt;.  Just add it to the css classes shown above.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-7335753358368321715?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/7335753358368321715/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=7335753358368321715&amp;isPopup=true' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7335753358368321715'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7335753358368321715'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2010/05/highlight-scrollbar-track.html' title='Highlight The ScrollBar Track'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_GHE-O4AUOwE/S-3u4bz9TXI/AAAAAAAAA3o/UG1gtavgs7Y/s72-c/scrollbar_highlighting.jpg' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-4269006845831446335</id><published>2010-04-21T13:08:00.000-07:00</published><updated>2012-01-27T15:22:42.278-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex 4'/><category scheme='http://www.blogger.com/atom/ns#' term='prompt'/><category scheme='http://www.blogger.com/atom/ns#' term='icon button'/><title type='text'>Prompting Controls (Spark/Flex 4)</title><content type='html'>Here are a few useful controls written in Flex 4 for displaying prompt text, and for showing an icon in a button.&lt;br /&gt;&lt;br /&gt;The &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex4/promptcontrols/srcview/source/flex/utils/spark/IconButton.as.html" target="_blank"&gt;IconButton&lt;/a&gt; class extends the defaults Flex 4 &lt;a href="http://help.adobe.com/en_US/FlashPlatform//reference/actionscript/3/spark/components/Button.html?allClasses=1" target="_blank"&gt;Button&lt;/a&gt; class, and adds the &lt;b&gt;icon&lt;/b&gt; style as well as the &lt;b&gt;labelPlacement&lt;/b&gt; (left, right, top, bottom) and &lt;b&gt;paddingLeft&lt;/b&gt;, &lt;b&gt;paddingTop&lt;/b&gt;, &lt;b&gt;paddingRight&lt;/b&gt;, and &lt;b&gt;paddingBottom&lt;/b&gt; styles.&lt;br /&gt;&lt;br /&gt;I also made a simple extension of the &lt;a href="http://help.adobe.com/en_US/FlashPlatform//reference/actionscript/3/spark/components/TextInput.html?allClasses=1" target="_blank"&gt;TextInput&lt;/a&gt; class which shows a prompt text when the text input is empty and not in focus, it is called &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex4/promptcontrols/srcview/source/flex/utils/spark/PromptingTextInput.as.html" target="_blank"&gt;PromptingTextInput&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The third example is called &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex4/promptcontrols/srcview/source/flex/utils/spark/ClearTextInput.as.html" target="_blank"&gt;ClearTextInput&lt;/a&gt;, it extends &lt;b&gt;PromptingTextInput&lt;/b&gt; to show a small clear button (which is a &lt;b&gt;IconButton&lt;/b&gt;) on the right hand side of the text input whenever there is text inside the text input.&lt;br /&gt;&lt;br /&gt;The fourth example is what I call a &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex4/promptcontrols/srcview/source/flex/utils/spark/PromptingList.as.html" target="_blank"&gt;PromptingList&lt;/a&gt;.  It shows a prompt text whenever the list is empty.  This is useful if you have a list that gets populated from a remote service (e.g "Loading..."), or if your list gets items added to it by the user, or by dragging items into the list (as in the example below).&lt;br /&gt;&lt;br /&gt;Each of the prompting controls supports a style called &lt;b&gt;promptStyleName&lt;/b&gt; which lets you set the styleName for the prompt Label.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;**&lt;/b&gt; Note that the package structure has been renamed to &lt;b&gt;flex.utils.spark.*&lt;/b&gt; for all Spark controls.&lt;br /&gt;&lt;br /&gt;Here it is:&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex4/promptcontrols/PromptTest.html?v=1.1" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="505" height="300"&gt;&lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-4269006845831446335?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/4269006845831446335/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=4269006845831446335&amp;isPopup=true' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/4269006845831446335'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/4269006845831446335'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2010/04/prompting-controls-sparkflex-4.html' title='Prompting Controls (Spark/Flex 4)'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-296802220245057646</id><published>2010-04-20T14:14:00.000-07:00</published><updated>2012-01-27T15:20:18.107-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Divider'/><category scheme='http://www.blogger.com/atom/ns#' term='color'/><category scheme='http://www.blogger.com/atom/ns#' term='DividedBox'/><category scheme='http://www.blogger.com/atom/ns#' term='background'/><title type='text'>Divider Background Color</title><content type='html'>Here is a simple component that extends the Flex 3 &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/containers/DividedBox.html" target="_blank"&gt;mx.containers.DividedBox&lt;/a&gt; class to provide two styles for filling in the background behind each divider.&lt;br /&gt;&lt;br /&gt;My component is creatively called &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/dividerbackground/srcview/source/flex/utils/ui/DividedBox.as.html" target="_blank"&gt;flex.utils.ui.DividedBox&lt;/a&gt;. It has all the same properties and styles as its parent, plus these two styles:&lt;ul&gt;&lt;li&gt;&lt;b&gt;dividerBackgroundColor&lt;/b&gt; - the background color behind each divider, defaults to #000000.&lt;/li&gt;&lt;li&gt;&lt;b&gt;dividerBackgroundAlpha&lt;/b&gt; - the alpha value for the background color, defaults to 1.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Here it is in action (View Source enabled):&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/dividerbackground/DividerBackground.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="290" height="230"&gt;&lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-296802220245057646?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/296802220245057646/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=296802220245057646&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/296802220245057646'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/296802220245057646'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2010/04/divider-background-color.html' title='Divider Background Color'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-5847459269429924384</id><published>2010-03-31T16:57:00.000-07:00</published><updated>2012-01-27T15:18:17.060-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tooltips'/><category scheme='http://www.blogger.com/atom/ns#' term='itemRenderer'/><category scheme='http://www.blogger.com/atom/ns#' term='Tree'/><category scheme='http://www.blogger.com/atom/ns#' term='positioning'/><title type='text'>Tree Item ToolTips</title><content type='html'>Here is how you can set custom tooltips in Flex 3 on each item in a &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/Tree.html"&gt;Tree&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;First, you have to set the following properties on the &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/Tree.html"&gt;Tree&lt;/a&gt;:&lt;ul&gt;&lt;li&gt;&lt;b&gt;showDataTips="true"&lt;/b&gt; - causes tooltips to be shown&lt;/li&gt;&lt;li&gt;&lt;b&gt;dataTipFunction="myDataTipFunction"&lt;/b&gt; - sets the function which returns the tooltip for each item&lt;/li&gt;&lt;li&gt;&lt;b&gt;itemRenderer="ToolTipItemRenderer"&lt;/b&gt; - tells the tree to use our custom renderer (which extends the default &lt;a href="http://livedocs.adobe.com/flex/3/langref/index.html"&gt;TreeItemRenderer&lt;/a&gt;)&lt;/li&gt;&lt;/ul&gt;The &lt;b&gt;itemRenderer&lt;/b&gt; isn't necessary unless you want to have control over where the tooltip is positioned (see below).&lt;br /&gt;&lt;br /&gt;Also note that if you set the &lt;b&gt;dataTipField&lt;/b&gt; property on the tree instead of the &lt;b&gt;dataTipFunction&lt;/b&gt; then your tooltips will only show up when the tree item isn't fully visible due to scrollbars.  By setting the &lt;b&gt;dataTipFunction&lt;/b&gt; it forces the tooltips to always show when the mouse is over the tree node.&lt;br /&gt;&lt;br /&gt;Now, on to the next problem.  By using the method above the tooltips are always displayed.  But the default position for the tooltip is right on top of the tree node, which is annoying.  So this is why we use our own custom item renderer so that we can position the tooltip below or above the node (or anywhere you want it).&lt;br /&gt;&lt;br /&gt;Here is an example with &lt;b&gt;View Source&lt;/b&gt; enabled:&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/treeitemtooltips/TreeItemToolTips.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="200" height="200"&gt;&lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-5847459269429924384?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/5847459269429924384/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=5847459269429924384&amp;isPopup=true' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/5847459269429924384'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/5847459269429924384'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2010/03/tree-item-tooltips.html' title='Tree Item ToolTips'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-8843461685363879032</id><published>2010-03-17T11:22:00.000-07:00</published><updated>2010-03-17T11:30:11.015-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='design mode'/><category scheme='http://www.blogger.com/atom/ns#' term='custom component'/><category scheme='http://www.blogger.com/atom/ns#' term='live preview'/><title type='text'>Custom Components Live Preview (Design Mode)</title><content type='html'>If you have created your own component and you drag it onto your Flex app in &lt;b&gt;Design Mode&lt;/b&gt; and it appears as a tiny almost invisible square on your screen, then watch the video below to see how you can get it working properly (like the default controls do).&lt;br /&gt;&lt;br /&gt;I found this awesome video tutorial on YouTube that explains how you can create what is called a &lt;b&gt;Live Preview&lt;/b&gt; of your component so that your custom component actually appears with the right appearance and dimensions.&lt;br /&gt;&lt;br /&gt;&lt;object width="640" height="385"&gt;&lt;param name="movie" value="http://www.youtube.com/v/v06NIDDSYag&amp;hl=en_US&amp;fs=1&amp;"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/v06NIDDSYag&amp;hl=en_US&amp;fs=1&amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;Be sure to check out the author's blog at &lt;a href="http://blog.flashgen.com"&gt;blog.flashgen.com&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The end result that I learned from this video is that if you have a &lt;b&gt;Flex Project&lt;/b&gt; which contains your custom component, and you try to use it in an MXML file then it won't work properly.  If the custom component is in a separate &lt;b&gt;Flex Library Project&lt;/b&gt; (or &lt;b&gt;SWC&lt;/b&gt;) then it will work properly. &lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-8843461685363879032?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/8843461685363879032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=8843461685363879032&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/8843461685363879032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/8843461685363879032'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2010/03/custom-components-live-preview-design.html' title='Custom Components Live Preview (Design Mode)'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-1185006916857831558</id><published>2010-03-04T19:31:00.000-08:00</published><updated>2012-01-27T15:16:51.737-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='resize handle'/><category scheme='http://www.blogger.com/atom/ns#' term='drag handle'/><title type='text'>DragHandle, ResizeHandle</title><content type='html'>Here are two customizable drag and resize handles:&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/resizecontainers/HandlesTest.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="260" height="265"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;You can set the following properties:&lt;ul&gt;&lt;li&gt;&lt;b&gt;rows&lt;/b&gt; - sets the number of rows of dots&lt;/li&gt;&lt;li&gt;&lt;b&gt;columns&lt;/b&gt; - sets the number of columns of dots&lt;/li&gt;&lt;li&gt;&lt;b&gt;dotSize&lt;/b&gt; - sets the dot size (defaults to 2)&lt;/li&gt;&lt;li&gt;&lt;b&gt;dropShadowEnabled&lt;/b&gt; - sets whether a drop shadow is used (defaults to false)&lt;/li&gt;&lt;li&gt;&lt;b&gt;dropShadowColor&lt;/b&gt; - sets the drop shadow color&lt;/li&gt;&lt;li&gt;&lt;b&gt;keepOnTop&lt;/b&gt; - if true then the handle will be on top of the other sibling components&lt;/li&gt;&lt;li&gt;&lt;b&gt;positionResizeHandle&lt;/b&gt; - If true then the resize handle will be positioned in the bottom right corner of the parent (ResizeHandle only)&lt;/li&gt;&lt;/ul&gt;&lt;b&gt;* Note&lt;/b&gt;: if you explicitly set the &lt;b&gt;width&lt;/b&gt; and &lt;b&gt;height&lt;/b&gt; of the DragHandle or ResizeHandle, then the &lt;b&gt;rows&lt;/b&gt; and &lt;b&gt;columns&lt;/b&gt; properties are ignored. In this case as many dots are rendered as will fit into that area.&lt;br /&gt;&lt;br /&gt;You can set the following styles too:&lt;ul&gt;&lt;li&gt;&lt;b&gt;backgroundColor&lt;/b&gt;, &lt;b&gt;backgroundAlpha&lt;/b&gt; - sets the background color alpha for the drag/resize handle&lt;/li&gt;&lt;li&gt;&lt;b&gt;dragHandleColor&lt;/b&gt;, &lt;b&gt;dragHandleAlpha&lt;/b&gt; - sets the color and alpha value for the drag handle&lt;/li&gt;&lt;li&gt;&lt;b&gt;resizeHandleColor&lt;/b&gt;, &lt;b&gt;resizeHandleAlpha&lt;/b&gt; - sets the color and alpha value for the resize handle&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;These two components are used in all the &lt;a href="http://flexdevtips.blogspot.com/2009/03/resizable-containers.html"&gt;Resizable Containers&lt;/a&gt;.&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-1185006916857831558?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/1185006916857831558/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=1185006916857831558&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/1185006916857831558'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/1185006916857831558'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2010/03/draghandle-resizehandle.html' title='DragHandle, ResizeHandle'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-9126165122937373090</id><published>2010-02-04T18:44:00.000-08:00</published><updated>2012-01-27T15:15:17.687-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='RadioButton'/><category scheme='http://www.blogger.com/atom/ns#' term='CheckBox'/><category scheme='http://www.blogger.com/atom/ns#' term='image'/><title type='text'>Image CheckBox and RadioButton</title><content type='html'>Here are two custom components that extend the &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/CheckBox.html" target="_blank"&gt;CheckBox&lt;/a&gt; and &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/RadioButton.html" target="_blank"&gt;RadioButton&lt;/a&gt; classes to render an image in between the checkbox/radiobutton icon and label.&lt;br /&gt;&lt;br /&gt;The main property to set is &lt;b&gt;imageSource&lt;/b&gt; which acts just like the &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/Image.html" target="_blank"&gt;Image.source&lt;/a&gt; property.  &lt;br /&gt;&lt;br /&gt;The image position depends on the &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/Button.html#labelPlacement" target="_blank"&gt;labelPlacement&lt;/a&gt; property (left, right, top, bottom) and the &lt;b&gt;horizontalGap&lt;/b&gt; style.  &lt;br /&gt;&lt;br /&gt;You can also set the &lt;b&gt;imageWidth&lt;/b&gt; and &lt;b&gt;imageHeight&lt;/b&gt; properties to scale the image down.  If you only set one of those properties then the other one is calculated to keep the image's width and height ratio the same.&lt;br /&gt;&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/imagecheckbox/ImageCheckBoxTest.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="290" height="150"&gt;&lt;/iframe&gt;&lt;br /&gt;Note that the &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/imagecheckbox/srcview/source/flex/utils/ui/ImageCheckBox.as.html" target="_blank"&gt;ImageCheckBox&lt;/a&gt; actually extends my &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/imagecheckbox/srcview/source/flex/utils/ui/CheckBox.as.html" target="_blank"&gt;flex.utils.ui.CheckBox&lt;/a&gt; class and not the expected &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/CheckBox.html" target="_blank"&gt;mx.controls.CheckBox&lt;/a&gt; class.&lt;br /&gt;&lt;br /&gt;The &lt;b&gt;flex.utils.ui.CheckBox&lt;/b&gt; class supports &lt;b&gt;backgroundColor&lt;/b&gt; and &lt;b&gt;backgroundAlpha&lt;/b&gt; styles, and as a result the background is always painted.  But the default alpha value is 0, so usually you won't see the background unless you set the background color and alpha.  The reason for this is that the default mx.controls.CheckBox class has a gap between the checkbox icon and the label (which is the horizontalGap style).  This gap causes mouse out events to fire when your cursor moves from the icon or label into this gap.  As a result the checkbox tooltip will disappear, and the checkbox will not have the rollover styles.  So by painting an invisible background color over the whole area of the checkbox this problem doesn't occur.  Same thing applies with the RadioButton class.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-9126165122937373090?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/9126165122937373090/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=9126165122937373090&amp;isPopup=true' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/9126165122937373090'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/9126165122937373090'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2010/02/image-checkbox.html' title='Image CheckBox and RadioButton'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-7568266100991280442</id><published>2010-01-29T12:02:00.000-08:00</published><updated>2012-01-27T15:14:14.484-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='cubic'/><category scheme='http://www.blogger.com/atom/ns#' term='dashed'/><category scheme='http://www.blogger.com/atom/ns#' term='curve'/><category scheme='http://www.blogger.com/atom/ns#' term='bezier'/><title type='text'>Drawing Dashed Lines, Arcs, and Cubic Curves</title><content type='html'>The ActionScript &lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/display/Graphics.html" target="_blank"&gt;Graphics&lt;/a&gt; class supports drawing &lt;b&gt;solid lines&lt;/b&gt; and &lt;b&gt;quadratic curves&lt;/b&gt;.  But there isn't native support for &lt;b&gt;dashed lines&lt;/b&gt; or &lt;b&gt;cubic (Bezier) curves&lt;/b&gt;. &lt;br /&gt;&lt;br /&gt;I've created a sample application that shows the three line types: &lt;b&gt;straight&lt;/b&gt;, &lt;b&gt;quadratic curve&lt;/b&gt; and &lt;b&gt;cubic curve&lt;/b&gt;.  It also lets you choose between showing a &lt;b&gt;solid line&lt;/b&gt;, a &lt;b&gt;dashed line&lt;/b&gt;, or both. The line thickness can also be adjusted.&lt;br /&gt;&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/dashedlines/DashedLines.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="540" height="445"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;I also got a little carried away and added the quadratic and cubic control points as buttons that you can drag around the canvas to change the curve.  &lt;br /&gt;&lt;br /&gt;Most of the drawing functionality for these examples is in the &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/dashedlines/srcview/source/flex/utils/GraphicsUtils.as.html" target="_blank"&gt;GraphicsUtils.as&lt;/a&gt; class that contains the following static functions:&lt;ul&gt;&lt;li&gt;&lt;b&gt;drawLine()&lt;/b&gt; - draws a straight line, either solid (using &lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/display/Graphics.html#curveTo()" target="_blank"&gt;Graphics.lineTo()&lt;/a&gt; function) or dashed&lt;/li&gt;&lt;li&gt;&lt;b&gt;drawQuadCurve()&lt;/b&gt; - draws a quadratic curve, either solid (using &lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/display/Graphics.html#curveTo()" target="_blank"&gt;Graphics.curveTo()&lt;/a&gt; function) or dashed&lt;/li&gt;&lt;li&gt;&lt;b&gt;drawCubicCurve()&lt;/b&gt; - draws a cubic curve (two control points), either solid or dashed.  The curve is an approximation done by dividing the curve into many small segments and drawing straight lines&lt;/li&gt;&lt;li&gt;&lt;b&gt;drawCircle()&lt;/b&gt; - draws a circle, either solid (using &lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/display/Graphics.html#drawCircle()" target="_blank"&gt;Graphics. drawCircle()&lt;/a&gt; function) or dashed&lt;/li&gt;&lt;li&gt;&lt;b&gt;drawArc()&lt;/b&gt; - draws an arc, either solid or dashed&lt;/li&gt;&lt;/ul&gt;The dashed lines are drawn by dividing the line into many small segments to draw the dashes.  By default a dash length of 10 pixels is used, but that is customizable.&lt;br /&gt;&lt;br /&gt;The equations used to calculate the values at any point along the line for the three cases were found on the Wikipedia entry for &lt;a href="http://en.wikipedia.org/wiki/Bezier_curve" target="_blank"&gt;Bézier curves&lt;/a&gt;.&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-7568266100991280442?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/7568266100991280442/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=7568266100991280442&amp;isPopup=true' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7568266100991280442'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7568266100991280442'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2010/01/drawing-dashed-lines-and-cubic-curves.html' title='Drawing Dashed Lines, Arcs, and Cubic Curves'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-4234637115358962207</id><published>2010-01-26T11:40:00.000-08:00</published><updated>2012-01-27T15:12:54.820-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='context menu'/><title type='text'>Flex Context Menus</title><content type='html'>I've had some frustration with Flex ContextMenus, so I thought I'd write an entry about the basics of creating context menus, adding items, listening for context menu events, and a few restrictions on context menus.&lt;br /&gt;&lt;br /&gt;Every &lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/display/InteractiveObject.html" target="_blank"&gt;InteractiveObject&lt;/a&gt; (e.g. Application, Panel, Button, etc) contains a &lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/display/InteractiveObject.html#contextMenu" target="_blank"&gt;contextMenu&lt;/a&gt; property.  For most components it will be null and you'll have to create a new menu and assign it to that property.  So you can have different context menus for different components.&lt;br /&gt;&lt;br /&gt;Here is a simple example of a context menu set on the application:&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/contextmenu/ContextMenus.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="400" height="200"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;Here is a short snippet from the above example showing you have to create a &lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/ui/ContextMenu.html" target="_blank"&gt;ContextMenu&lt;/a&gt;, hide the built-in menu items, and listen for menu events.&lt;br /&gt;&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;initContextMenu&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;:&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;1.&amp;nbsp;Create&amp;nbsp;the&amp;nbsp;context&amp;nbsp;menu&amp;nbsp;if&amp;nbsp;it&amp;nbsp;doesn't&amp;nbsp;exist&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;it&amp;nbsp;will&amp;nbsp;exist&amp;nbsp;for&amp;nbsp;the&amp;nbsp;application,&amp;nbsp;but&amp;nbsp;won't&amp;nbsp;for&amp;nbsp;most&amp;nbsp;other&amp;nbsp;components&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;if&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;!contextMenu&lt;/font&gt;&lt;font color="#000000"&gt;)&amp;nbsp;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;this&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;.contextMenu&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;ContextMenu&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;2.&amp;nbsp;Hide&amp;nbsp;the&amp;nbsp;built-in&amp;nbsp;menu&amp;nbsp;items&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;(you&amp;nbsp;can't&amp;nbsp;remove&amp;nbsp;the&amp;nbsp;basic&amp;nbsp;3&amp;nbsp;or&amp;nbsp;4&amp;nbsp;items&amp;nbsp;like:&amp;nbsp;Settings,&amp;nbsp;About,&amp;nbsp;etc)&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;contextMenu.hideBuiltInItems&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;3.&amp;nbsp;Add&amp;nbsp;menu&amp;nbsp;items,&amp;nbsp;you&amp;nbsp;can&amp;nbsp;optionally&amp;nbsp;set&amp;nbsp;the&amp;nbsp;menu&amp;nbsp;item&amp;nbsp;enablement&amp;nbsp;and&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;visibility&amp;nbsp;in&amp;nbsp;the&amp;nbsp;ContextMenuItem&amp;nbsp;constructor&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;firstItem:ContextMenuItem&amp;nbsp;&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;ContextMenuItem&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;Hello&amp;nbsp;there!&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;true&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;contextMenu.customItems.push&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;firstItem&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;secondItem:ContextMenuItem&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;ContextMenuItem&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;Disabled&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;contextMenu.customItems.push&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;secondItem&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;thirdItem:ContextMenuItem&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;ContextMenuItem&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;Hidden&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;contextMenu.customItems.push&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;thirdItem&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;4.&amp;nbsp;Listen&amp;nbsp;for&amp;nbsp;menu&amp;nbsp;events&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;this&amp;nbsp;event&amp;nbsp;happens&amp;nbsp;when&amp;nbsp;the&amp;nbsp;context&amp;nbsp;menu&amp;nbsp;is&amp;nbsp;about&amp;nbsp;to&amp;nbsp;show&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;contextMenu.addEventListener&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;ContextMenuEvent.MENU_SELECT,&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;event:ContextMenuEvent&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;:&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;add&amp;nbsp;logic&amp;nbsp;here&amp;nbsp;to&amp;nbsp;determine&amp;nbsp;the&amp;nbsp;visibility&amp;nbsp;or&amp;nbsp;enablement&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;secondItem.enabled&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;false&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;thirdItem.visible&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;false&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;})&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;5.&amp;nbsp;Handle&amp;nbsp;menu&amp;nbsp;item&amp;nbsp;click&amp;nbsp;events&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;handler:Function&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;event:ContextMenuEvent&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;:&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;Alert.show&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;You&amp;nbsp;clicked&amp;nbsp;on&amp;nbsp;the&amp;nbsp;menu&amp;nbsp;item&amp;nbsp;'&amp;#34;&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;+&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;event.currentTarget.caption&amp;nbsp;+&amp;nbsp;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;'&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;firstItem.addEventListener&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;ContextMenuEvent.MENU_ITEM_SELECT,&amp;nbsp;handler&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;secondItem.addEventListener&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;ContextMenuEvent.MENU_ITEM_SELECT,&amp;nbsp;handler&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;thirdItem.addEventListener&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;ContextMenuEvent.MENU_ITEM_SELECT,&amp;nbsp;handler&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;There are many &lt;b&gt;&lt;font color="#990000"&gt;restrictions&lt;/font&gt;&lt;/b&gt; to Flex ContextMenus, some of which will drive you crazy. Read carefully, it will save you time later.&lt;ul&gt;&lt;li&gt;Maximum of 15 custom menu items in the menu&lt;/li&gt;&lt;li&gt;No sub-menus allowed&lt;/li&gt;&lt;li&gt;No icons in menus&lt;/li&gt;&lt;li&gt;Menu items must be 100 characters or less&lt;/li&gt;&lt;li&gt;Control characters, newlines, and other white space characters are ignored&lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;font color="#990000"&gt;MANY&lt;/font&gt;&lt;/b&gt; reserved words including (but not limited to):&lt;ul style="color: #990000;font-weight:bold"&gt;&lt;li&gt;Save&lt;/li&gt;&lt;li&gt;Zoom In&lt;/li&gt;&lt;li&gt;Zoom Out&lt;/li&gt;&lt;li&gt;100%&lt;/li&gt;&lt;li&gt;Show All&lt;/li&gt;&lt;li&gt;Quality&lt;/li&gt;&lt;li&gt;Play&lt;/li&gt;&lt;li&gt;Loop&lt;/li&gt;&lt;li&gt;Rewind&lt;/li&gt;&lt;li&gt;Forward&lt;/li&gt;&lt;li&gt;Back&lt;/li&gt;&lt;li&gt;Movie not loaded&lt;/li&gt;&lt;li&gt;About&lt;/li&gt;&lt;li&gt;Print&lt;/li&gt;&lt;li&gt;Show Redraw Regions&lt;/li&gt;&lt;li&gt;Debugger&lt;/li&gt;&lt;li&gt;Undo&lt;/li&gt;&lt;li&gt;Cut&lt;/li&gt;&lt;li&gt;Copy&lt;/li&gt;&lt;li&gt;Paste&lt;/li&gt;&lt;li&gt;Delete&lt;/li&gt;&lt;li&gt;Select All&lt;/li&gt;&lt;li&gt;Open&lt;/li&gt;&lt;li&gt;Open in new window&lt;/li&gt;&lt;li&gt;Copy link&lt;/li&gt;&lt;li&gt;Copy Link Location&lt;/li&gt;&lt;li&gt;Del&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;I'm not quite sure why there are so many restrictions, but I'm sure Adobe has a good reason for it!&lt;br /&gt;&lt;br /&gt;More details about the restrictions can be found on the &lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/ui/ContextMenuItem.html" target="_blank"&gt;ContextMenuItem&lt;/a&gt; page.  &lt;br /&gt;&lt;br /&gt;There are a few other solutions for people who want more control over the menus.  These usually involve adding right click listeners in JavaScript on top of the Flex application and passing that event into Flex to position and show a custom menu instead of the usual Flex context menu.  &lt;br /&gt;Here is one such solution: &lt;a href="http://code.google.com/p/custom-context-menu/"&gt;Custom Context Menu&lt;/a&gt;.&lt;br /&gt;These solutions can work quite effectively, but since they depend on the browser they can be quite buggy.&lt;br /&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-4234637115358962207?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/4234637115358962207/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=4234637115358962207&amp;isPopup=true' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/4234637115358962207'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/4234637115358962207'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2010/01/flex-context-menus.html' title='Flex Context Menus'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-2503811012649328860</id><published>2009-11-04T10:07:00.000-08:00</published><updated>2009-11-04T11:37:38.514-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='function'/><category scheme='http://www.blogger.com/atom/ns#' term='rest'/><category scheme='http://www.blogger.com/atom/ns#' term='parameters'/><title type='text'>Pass ...rest as a parameter to another function</title><content type='html'>I recently needed to have a function that accepted a variable number of parameters. This can easily be accomplished using the &lt;code&gt;function myFunction(...rest)&lt;/code&gt; syntax.  This way I can pass in no parameters (in which case &lt;b&gt;rest&lt;/b&gt; is an empty array), one parameter, or multiple parameters.&lt;br /&gt;&lt;br /&gt;But, then I wanted to pass those same parameters on to another function that also accepted a variable number of parameters (e.g. &lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/external/ExternalInterface.html#call()" target="_blank"&gt;ExternalInterface.call(jsFunctionName, ...args)&lt;/a&gt;). If you simply call the other function and pass in &lt;b&gt;rest&lt;/b&gt; as a parameter then it won't work as expected.  E.g.&lt;br /&gt;&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;sayHello&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;...rest&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;:&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;this&amp;nbsp;won't&amp;nbsp;work&amp;nbsp;as&amp;nbsp;expected&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;callMe&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;rest&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;callMe&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;...rest&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;:&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;trace&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;rest.length&amp;nbsp;+&amp;nbsp;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;:&amp;nbsp;['&amp;#34;&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;+&amp;nbsp;rest.join&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;'&amp;nbsp;|&amp;nbsp;'&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;+&amp;nbsp;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;']&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;What happens in &lt;code&gt;callMe(...rest)&lt;/code&gt; is &lt;code&gt;rest&lt;/code&gt; is an array that actually contains only one item - another array which has the rest parameters that were originally passed into &lt;code&gt;sayHello(...rest)&lt;/code&gt;.&lt;br /&gt;So if you made a call like this:&lt;br /&gt;&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;sayHello&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;Hello&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;World&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;!&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;Then the traced output would be &lt;b&gt;1: ['Hello,World,!']&lt;/b&gt;.&lt;br /&gt;Notice that there is only 1 parameter!&lt;br /&gt;&lt;br /&gt;The way to get around this is to use &lt;a href="http://livedocs.adobe.com/flex/3/langref/Function.html#apply()" target="_blank"&gt;Function.apply(null, args)&lt;/a&gt; to call the function instead, like this:&lt;br /&gt;&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;sayHello2&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;...rest&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;:&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;use&amp;nbsp;Function.apply&amp;nbsp;to&amp;nbsp;pass&amp;nbsp;in&amp;nbsp;the&amp;nbsp;rest&amp;nbsp;parameters&amp;nbsp;properly&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;func:Function&amp;nbsp;=&amp;nbsp;callMe;&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;func.apply&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;rest&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;So if you made this call now:&lt;br /&gt;&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;sayHello2&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;Hello&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;World&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;!&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;Then the traced output would be &lt;b&gt;3: ['Hello' | 'World' | '!']&lt;/b&gt;.&lt;br /&gt;Now there are 3 parameters as expected.&lt;br /&gt;&lt;br /&gt;I found some help on this topic from &lt;a href="http://www.colettas.org/?p=18"&gt;The Joy Of Flex&lt;/a&gt; Blog by David Colleta.&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-2503811012649328860?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/2503811012649328860/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=2503811012649328860&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/2503811012649328860'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/2503811012649328860'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/11/pass-rest-as-parameter-to-another.html' title='Pass ...rest as a parameter to another function'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-2938266816236745311</id><published>2009-10-23T14:09:00.000-07:00</published><updated>2012-01-27T15:11:22.773-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CheckBox'/><category scheme='http://www.blogger.com/atom/ns#' term='Filter'/><category scheme='http://www.blogger.com/atom/ns#' term='Chart'/><category scheme='http://www.blogger.com/atom/ns#' term='Legend'/><category scheme='http://www.blogger.com/atom/ns#' term='Series'/><title type='text'>LineChart with CheckBox Legend (Filter Series)</title><content type='html'>The following example shows a &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/charts/LineChart.html" target="_blank"&gt;LineChart&lt;/a&gt; with a custom &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/charts/Legend.html" target="_blank"&gt;Legend&lt;/a&gt; that has &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/CheckBox.html"&gt;CheckBox&lt;/a&gt;es next to each &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/charts/LegendItem.html" target="_blank"&gt;LegendItem&lt;/a&gt; which allows you to filter the Chart to only show certain series (in this case lines). &lt;br /&gt;&lt;br /&gt;I've created a custom class called &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/checkboxlegend/srcview/source/flex/utils/ui/charts/CheckBoxLegend.mxml.html" target="ViewSource"&gt;CheckBoxLegend&lt;/a&gt; which extends &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/charts/Legend.html" target="_blank"&gt;Legend&lt;/a&gt;.  It sets the &lt;b&gt;legendItemClass&lt;/b&gt; to be the &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/checkboxlegend/srcview/source/flex/utils/ui/charts/CheckBoxLegendItem.mxml.html" target="ViewSource"&gt;flex.utils.ui.charts.CheckBoxLegendItem&lt;/a&gt; class which extends the default &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/charts/LegendItem.html" target="_blank"&gt;LegendItem&lt;/a&gt; to add the CheckBox on the left side of the legend item.&lt;br /&gt;&lt;br /&gt;Clicking on the legend item toggles the CheckBox and updates the Chart to show or hide the corresponding series.  The series is hidden by setting the &lt;b&gt;alpha&lt;/b&gt; value to 0.&lt;br /&gt;&lt;br /&gt;Here is a snippet of how you use it in MXML:&lt;br /&gt;&lt;div align="left" class="code"&gt;&lt;font color="#0000ff"&gt;&amp;lt;mx:Application &lt;/font&gt;xmlns:mx=&lt;font color="#990000"&gt;"http://www.adobe.com/2006/mxml"&lt;/font&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;xmlns:charts=&lt;font color="#990000"&gt;"flex.utils.ui.charts.*"&lt;/font&gt;&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#0000ff"&gt;&amp;lt;mx:LineChart &lt;/font&gt;&lt;font color="#000000"&gt;id=&lt;/font&gt;&lt;font color="#990000"&gt;"linechart"&lt;/font&gt; ... &lt;font color="#0000ff"&gt;/&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;font color="#0000ff"&gt;&amp;lt;charts:CheckBoxLegend &lt;/font&gt;&lt;font color="#000000"&gt;dataProvider=&lt;/font&gt;&lt;font color="#990000"&gt;"{linechart}"&lt;/font&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#000000"&gt;color=&lt;/font&gt;&lt;font color="#990000"&gt;"#000000"&lt;/font&gt; &lt;font color="#000000"&gt;direction=&lt;/font&gt;&lt;font color="#990000"&gt;"horizontal"&lt;/font&gt;&lt;font color="#0000ff"&gt;/&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#0000ff"&gt;&amp;lt;/mx:Application&amp;gt;&lt;/font&gt;&lt;/div&gt;&lt;br /&gt;Here is the example, right click to view source:&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/checkboxlegend/CheckBoxLegendTest.html?v=1.3.3" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="600" height="415"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;Note that the &lt;b&gt;minimum&lt;/b&gt; and &lt;b&gt;maximum&lt;/b&gt; values of the vertical axis don't get updated when you uncheck one or more series.  The Axis calculates these values but doesn't take into account the visibility of the &lt;b&gt;Series&lt;/b&gt;.  So I've added a new &lt;b&gt;Update Vertical Axis Min/Max&lt;/b&gt; CheckBox that will go through all the &lt;b&gt;y&lt;/b&gt; axis number values and calculate the minimum and maximum values for the visible series.  I haven't tested this out on complicated datasets or different chart types, but hopefully it will be a good starting point.&lt;br /&gt;&lt;br /&gt;Originally I played around with actually removing the series from the chart (instead of hiding it), but that caused more problems because when you remove a series the chart will automatically re-color any of the remaining series (unless you specified the stroke/color/fill styles) and the legend gets re-populated without the unchecked series.  So it was easiest to just hide the series.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-2938266816236745311?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/2938266816236745311/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=2938266816236745311&amp;isPopup=true' title='52 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/2938266816236745311'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/2938266816236745311'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/10/linechart-with-checkbox-legend.html' title='LineChart with CheckBox Legend (Filter Series)'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>52</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-4884529230538251229</id><published>2009-10-22T14:17:00.001-07:00</published><updated>2012-01-27T15:19:04.433-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Yahoo Maps'/><category scheme='http://www.blogger.com/atom/ns#' term='Elevation'/><category scheme='http://www.blogger.com/atom/ns#' term='Custom Marker'/><title type='text'>Elevation Map using USGS and Yahoo Maps</title><content type='html'>&lt;b&gt;&lt;font color="#663399"&gt;** January 2012 Update&lt;/b&gt;&lt;br /&gt;Yahoo has officially shut down support for Flex maps, so this example no longer works.  For other options try the &lt;a href="http://code.google.com/apis/maps/documentation/flash/" target="_blank"&gt;Google Flash Maps&lt;/a&gt; component (which is also deprecated now too)&lt;/font&gt;&lt;br /&gt;&lt;br/&gt;This example combines two different services:&lt;br /&gt;&lt;li&gt;&lt;a href="http://developer.yahoo.com/flash/maps/" target="_blank"&gt;Flex Yahoo Maps&lt;/a&gt; - shows an interactive map component similar to Google Maps (Flex 3).&lt;/li&gt;&lt;li&gt;&lt;a href="http://gisdata.usgs.net/XMLWebServices/TNM_Elevation_Service.php" target="_blank"&gt;USGS Elevation Service&lt;/a&gt; - gets the elevation at a given Latitude and Longitude.&lt;/li&gt;&lt;br /&gt;The Flex application below has the Yahoo Maps component on top and an &lt;A href="http://livedocs.adobe.com/flex/3/langref/mx/charts/AreaChart.html" target="_blank"&gt;AreaChart&lt;/a&gt; below which will show the elevation.&lt;br /&gt;Click on the map to add a marker.  When you click again in a different location another marker is added, and the elevation chart at the bottom will show the elevation profile for the two points.  If you want a more fine-grained elevation profile you can use the drop-down menu above the elevation chart to adjust how frequently the elevation is looked up (every KM, every 500m, every 200m).  Keep in mind that the more elevations you look up the slower it is.  &lt;br /&gt;&lt;br /&gt;You can also search for an address too using the search bar.  The elevation at the search location will be displayed in the toolbar to the right of the search button.  You can also show kilometer markers as well by checking the &lt;b&gt;Show KM Markers&lt;/b&gt; checkbox in the top toolbar.&lt;br /&gt;&lt;br /&gt;Feel free to use this code for your own purposes.  All you have to do is sign up for a Yahoo Maps key here:&lt;br /&gt;&lt;a href="https://developer.apps.yahoo.com/wsregapp/" target=_"blank"&gt;https://developer.apps.yahoo.com/wsregapp/&lt;/a&gt; &lt;br /&gt;And then edit the ElevationMapFunctions.as file and put your key in the APPID constant.&lt;br /&gt;Here is the &lt;a href="http://developer.yahoo.com/flash/maps/classreference/index.html" target="_blank"&gt;Yahoo Maps API&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;There are also a few custom markers included in the source code that you can use and/or modify for your own needs.  &lt;br /&gt;&lt;br /&gt;Use the mouse scroll wheel to zoom in or out (or use the +/- control on the map).&lt;br /&gt;&lt;br /&gt;This is a very simple example and a lot more could be done with it.  It's really just to show how to get elevation data from the USGS Web Service, and how to add markers to a Yahoo Map.&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/elevationmap/ElevationMap.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="700" height="700"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;** November 2009 Update&lt;/b&gt;&lt;br /&gt;I've updated the example to include another custom marker - the &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/elevationmap/srcview/source/markers/TitleMarker.as.html" target="_blank"&gt;TitleMarker&lt;/a&gt;.  This marker shows a label on the marker when it is collapsed.  I've also added the option of &lt;b&gt;Showing KM Markers&lt;/b&gt; which are displayed as TitleMarkers.  &lt;br /&gt;I also separated the Elevation code into separate packages, and added some operations to allow querying for multiple elevations in sequence.  When an elevation is returned from the USGS web service it is cached in the &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/elevationmap/srcview/source/services/ElevationService.as.html" target="_blank"&gt;ElevationService&lt;/a&gt; class to speed things up.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;** January 2010 Update&lt;/b&gt;&lt;br /&gt;I've restricted the number of elevations that can be looked up at one time to 30.  This is to prevent someone trying to lookup the elevation every 200m between Canada and Europe.  If you download the source code, and get your own yahoo maps application id then you can do what you like!&lt;br /&gt;&lt;br/&gt;&lt;b&gt;&lt;font color="#663399"&gt;** January 2012 Update&lt;/b&gt;&lt;br /&gt;Yahoo has officially shut down support for Flex maps, so this example no longer works.  For other options try the &lt;a href="http://code.google.com/apis/maps/documentation/flash/" target="_blank"&gt;Google Flash Maps&lt;/a&gt; component (which is also deprecated now too)&lt;/font&gt;&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-4884529230538251229?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/4884529230538251229/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=4884529230538251229&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/4884529230538251229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/4884529230538251229'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/10/elevation-map-using-usgs-and-yahoo-maps.html' title='Elevation Map using USGS and Yahoo Maps'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-2573812813005631775</id><published>2009-09-25T10:51:00.001-07:00</published><updated>2009-09-25T10:59:31.286-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='multiple classes in same file'/><category scheme='http://www.blogger.com/atom/ns#' term='helper classes'/><category scheme='http://www.blogger.com/atom/ns#' term='internal classes'/><title type='text'>Helper Classes in ActionScript</title><content type='html'>I've had a few people ask me recently if you can have multiple classes defined in the same file in ActionScript.  This is something that Java developers are probably very familiar with. &lt;br /&gt;&lt;br /&gt;Well the answer is yes, you can.  They are called &lt;b&gt;Helper Classes&lt;/b&gt;, but they are defined a little bit differently from how you might expect, and from how it is done in Java.&lt;br /&gt;&lt;br /&gt;Here's a simple example of a helper class:&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#9900cc"&gt;&lt;b&gt;package&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;helper&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#9900cc"&gt;&lt;b&gt;class&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;MainClass&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;MainClass&lt;/font&gt;&lt;font color="#000000"&gt;()&amp;nbsp;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;helperCls:HelperClass1&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;HelperClass1&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;import&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;mx.controls.TextInput;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;&lt;br/&gt;&lt;font color="#9900cc"&gt;&lt;b&gt;class&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;HelperClass1&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;extends&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;TextInput&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;HelperClass1&lt;/font&gt;&lt;font color="#000000"&gt;()&amp;nbsp;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;Notice that the helper class is defined &lt;b&gt;outside&lt;/b&gt; of the package wrapper.  And yes, multiple helper classes are allowed in the same file.  One thing that surprised me was how the helper class has its own separate section for imports that are also outside of the package block.&lt;br /&gt;&lt;br /&gt;Note that helper classes are only available to the main class, and cannot be accessed outside of that file.  Even a subclass can't use helper classes belonging to its superclass.&lt;br /&gt;&lt;br /&gt;Here is another website which has some more information on this topic:&lt;br /&gt;&lt;a href="http://www.rubenswieringa.com/blog/class-syntax-in-actionscript30"&gt;Class syntax in ActionScript 3.0&lt;/a&gt;.&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-2573812813005631775?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/2573812813005631775/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=2573812813005631775&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/2573812813005631775'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/2573812813005631775'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/09/helper-classes-in-actionscript.html' title='Helper Classes in ActionScript'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-1853392760216806878</id><published>2009-09-10T13:14:00.000-07:00</published><updated>2012-01-27T14:57:23.214-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='split'/><category scheme='http://www.blogger.com/atom/ns#' term='image'/><category scheme='http://www.blogger.com/atom/ns#' term='air'/><title type='text'>Image Splitter in AIR</title><content type='html'>&lt;table width="100%"&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;br /&gt;I haven't played with Adobe AIR much, and thought I'd give it a try.  I have a whole bunch of sprites - images that contain many different smaller images all side by side - that I wanted to split up into separate images.&lt;br /&gt;  &lt;br /&gt;So I decided to use Adobe AIR to solve this simple problem. The WindowedApplication lets you choose an input image file and an output directory.  The image is loaded into the window and then you can choose the column width and row height for how you want to split the image up.  Alternatively you can specify the number of rows and columns.  This will draw a gray grid on top of the input image showing you how the image will be split up.&lt;br /&gt;&lt;br /&gt;Click on the images on the right side of the page to see the full size image.  The top screenshot shows the input image being split into 6 columns and 4 rows.  The middle screenshot shows how the background color can be made transparent.  And the bottom example shows the output images.&lt;br /&gt;&lt;br /&gt;You can also choose between using the &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/graphics/codec/JPEGEncoder.html" target="_blank"&gt;JPEGEncoder&lt;/a&gt; or the &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/graphics/codec/PNGEncoder.html" target="_blank"&gt;PNGEncoder&lt;/a&gt; (PNG supports transparency).  If you choose PNG then you can also optionally choose a color that you want to make transparent (e.g. the background color).  You can click on the input image to choose the color you want transparent, or you can use the &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/ColorPicker.html" target="_blank"&gt; ColorPicker&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;There is a filename prefix textbox too for choosing how you want the output files named.  After the prefix a number will be appended (e.g. mario1.png, mario2.png) for each output image.  Output images will not overwrite existing images unless you check the Overwrite checkbox.&lt;br /&gt;&lt;br /&gt;Feel free to modify for you own use.  Because it's an AIR application I've only attached screenshots. &lt;br /&gt;&lt;br /&gt;&lt;font color="#cc0000"&gt;&lt;b&gt;&lt;a  href="http://chris.firlingcanada.com/flexdevtips/flex3/imagesplitter/FlexDevTips_ImageSplitter.zip"&gt;- DOWNLOAD SOURCE ZIP FILE -&lt;/a&gt;&lt;br&gt;&lt;br /&gt;&lt;a  href="http://chris.firlingcanada.com/flexdevtips/flex3/imagesplitter/srcview/" target="_blank"&gt;- VIEW SOURCE -&lt;/a&gt;&lt;/b&gt;&lt;/font&gt;&lt;br /&gt;&lt;/td&gt;&lt;td width="15"&gt;&amp;nbsp;&lt;/td&gt;&lt;td valign="top"&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;Input Image&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/imagesplitter/input.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 250px;" src="http://chris.firlingcanada.com/flexdevtips/flex3/imagesplitter/input.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;Transparent background&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/imagesplitter/transparency.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 250px;" src="http://chris.firlingcanada.com/flexdevtips/flex3/imagesplitter/transparency.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;Output Images&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/imagesplitter/output.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 250px;" src="http://chris.firlingcanada.com/flexdevtips/flex3/imagesplitter/output.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-1853392760216806878?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/1853392760216806878/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=1853392760216806878&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/1853392760216806878'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/1853392760216806878'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/09/image-splitter-in-air.html' title='Image Splitter in AIR'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-5636582805938336836</id><published>2009-08-11T10:28:00.000-07:00</published><updated>2009-09-03T11:47:15.950-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Flex Component Explorer'/><category scheme='http://www.blogger.com/atom/ns#' term='Styles'/><category scheme='http://www.blogger.com/atom/ns#' term='Tour de Flex'/><title type='text'>Tour de Flex and Flex Component Explorer</title><content type='html'>If you haven't already seen this awesome Flex website then check it out.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;&lt;a href="http://www.adobe.com/devnet/flex/tourdeflex/web/#"&gt;Tour de Flex&lt;/a&gt;&lt;/h2&gt;&lt;br /&gt;It has examples (including source code) of all the common Flex 3 components (DataGrid, Tree, Button, Canvas, etc) as well as a TON of other examples (269 at the last count) from various open source projects including Flex Yahoo Maps, advanced Data Visualizations (3D charts, gantt charts, calendar views, etc), Cloud APIs (searching Amazon, eBay, Flickr, etc) and much more.&lt;br /&gt;&lt;br /&gt;There is also the original &lt;a href="http://examples.adobe.com/flex3/componentexplorer/explorer.html" target="_blank"&gt;Adobe Flex 3 Component Explorer&lt;/a&gt; which contains examples of just the core Flex 3 components.&lt;br /&gt;&lt;br /&gt;For examples on styling components check out the &lt;a href="http://examples.adobe.com/flex3/consulting/styleexplorer/Flex3StyleExplorer.html#" target="_blank"&gt;Flex 3 Style Explorer&lt;/a&gt; site.  I also find this list of all the styles for each Flex component useful: &lt;A href="http://www.loscavio.com/downloads/blog/flex3_css_list/flex3_css_list.htm" target="_blank"&gt;Flex 3.0 CSS Properties List&lt;/a&gt;.&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-5636582805938336836?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/5636582805938336836/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=5636582805938336836&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/5636582805938336836'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/5636582805938336836'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/08/tour-de-flex.html' title='Tour de Flex and Flex Component Explorer'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-7314515506106336130</id><published>2009-08-07T11:13:00.000-07:00</published><updated>2012-01-27T14:55:27.396-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='validator'/><category scheme='http://www.blogger.com/atom/ns#' term='word count'/><category scheme='http://www.blogger.com/atom/ns#' term='words'/><category scheme='http://www.blogger.com/atom/ns#' term='trim'/><category scheme='http://www.blogger.com/atom/ns#' term='StringWordValidator'/><title type='text'>Counting Words, StringWordValidator</title><content type='html'>I was recently required to limit the number of words in a &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/TextArea.html" target="TextArea"&gt;TextArea&lt;/a&gt;.  It's easy to limit the number of characters by using the &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/TextArea.html#maxChars" target="TextArea"&gt;TextArea.maxChars&lt;/a&gt; property, but how do you restrict the number of &lt;i&gt;words&lt;/i&gt;?&lt;br /&gt;&lt;br /&gt;The way I solved this problem was to make a new class that extends &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/validators/StringValidator.html" target="Validator"&gt;mx.validators.StringValidator&lt;/a&gt; and adds the following properties:&lt;ul&gt;&lt;li&gt;&lt;b&gt;maxWords&lt;/b&gt; - the maximum number of words allowed&lt;/li&gt;&lt;li&gt;&lt;b&gt;minWords&lt;/b&gt; - the minimum number of words allowed&lt;/li&gt;&lt;li&gt;&lt;b&gt;tooManyWordsError&lt;/b&gt; - the error string to be displayed when too many words are entered&lt;/li&gt;&lt;li&gt;&lt;b&gt;tooFewWordsError&lt;/b&gt; - the error string when not enough words are entered&lt;/li&gt;&lt;li&gt;&lt;b&gt;trim&lt;/b&gt; - trims the input string before the validation occurs&lt;/ul&gt;&lt;br /&gt;Here is the utility function I wrote for counting how many words are in a string:&lt;br /&gt;&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;/**&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;*&amp;nbsp;Splits&amp;nbsp;the&amp;nbsp;text&amp;nbsp;into&amp;nbsp;words&amp;nbsp;and&amp;nbsp;returns&amp;nbsp;the&amp;nbsp;number&amp;nbsp;of&amp;nbsp;words&amp;nbsp;found.&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;*&amp;nbsp;If&amp;nbsp;the&amp;nbsp;text&amp;nbsp;is&amp;nbsp;null&amp;nbsp;or&amp;nbsp;blank&amp;nbsp;(trimmed)&amp;nbsp;then&amp;nbsp;0&amp;nbsp;is&amp;nbsp;returned.&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;*&amp;nbsp;The&amp;nbsp;regular&amp;nbsp;expression&amp;nbsp;used&amp;nbsp;is&amp;nbsp;/\s+/g&amp;nbsp;which&amp;nbsp;splits&amp;nbsp;the&amp;nbsp;text&amp;nbsp;into&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;*&amp;nbsp;words&amp;nbsp;based&amp;nbsp;on&amp;nbsp;whitespace.&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;*/&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;public&amp;nbsp;static&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;countWords&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;txt:String&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;:uint&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;count:uint&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;if&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;txt&amp;nbsp;!=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&amp;nbsp;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;txt&amp;nbsp;=&amp;nbsp;StringUtil.trim&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;txt&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;if&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;txt.length&amp;nbsp;&amp;gt;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;)&amp;nbsp;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;count&amp;nbsp;=&amp;nbsp;txt.split&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;/\s+/g&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;.length;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;return&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;count;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;And here is it in action (&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/countwords/srcview/" target="ViewSource"&gt;view source&lt;/a&gt;).  The validator will run when the TextArea loses focus (that is the default behavior), so try typing in one word and then pressing tab. You can also adjust the minimum and maximum number of words allowed and the validation will be updated immediately.&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/countwords/CountingWords.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="500" height="220"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/countwords/srcview/source/flex/utils/ui/validators/StringWordValidator.as.html" target="StringWordValidator"&gt;StringWordValidator&lt;/a&gt; source&lt;/li&gt;&lt;li&gt;&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/countwords/srcview/source/flex/utils/ui/validators/ErrorTipManager.as.html" target="ErrorTipManager"&gt;ErrorTipManager&lt;/a&gt; source (see previous blog post on &lt;a href="http://flexdevtips.blogspot.com/2009/08/always-showing-error-tips-validators.html"&gt;Always showing error tips&lt;/a&gt;)&lt;/li&gt;&lt;br /&gt;I also included the &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/countwords/srcview/source/flex/utils/ui/resize/ResizableTextArea.as.html" target="ResizableTextArea"&gt;ResizableTextArea&lt;/a&gt; class too just for fun.&lt;br /&gt;&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-7314515506106336130?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/7314515506106336130/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=7314515506106336130&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7314515506106336130'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7314515506106336130'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/08/counting-words-stringwordvalidator.html' title='Counting Words, StringWordValidator'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-4904548991535738752</id><published>2009-08-06T14:43:00.001-07:00</published><updated>2012-01-27T14:53:46.525-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='validator'/><category scheme='http://www.blogger.com/atom/ns#' term='error tips'/><category scheme='http://www.blogger.com/atom/ns#' term='error messages'/><title type='text'>Always showing error tips (validators)</title><content type='html'>&lt;img style="float:right; margin:0 0 10px 10px;" src="http://chris.firlingcanada.com/flexdevtips/flex3/errortips/mystery-meat-error-messages.gif" border="0" alt="" /&gt;&lt;br /&gt;Many people have complained about how Flex 3's error validation messages are not shown unless you hover your mouse over the input field that is invalid.  See the image on the right and you'll probably know what I'm talking about.  If not, then when you use a &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/validators/Validator.html" target="_blank"&gt;mx.validators.Validator&lt;/a&gt; on an input field  such as a TextInput or TextArea and the user enters invalid data then the input control gets a red border indicating an error.  But the error message (e.g. "This field is required") is ONLY displayed when the user hovers the mouse over the input field.     &lt;br /&gt;&lt;br /&gt;After reading a few other posts on the subject, including a &lt;a href="http://bugs.adobe.com/jira/browse/SDK-11256" target="_blank"&gt;bug report&lt;/a&gt; that is in the Adobe Bug Tracker I decided to see if I could come up with a nice easy solution.&lt;br /&gt;&lt;br /&gt;I made a new class called &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/errortips/srcview/source/flex/utils/ui/validators/ErrorTipManager.as.html" target="_blank"&gt;ErrorTipManager&lt;/a&gt; that has a bunch of public static functions that lets you easily attach your validators (or your own validation functions).  The code is documented, so view the sample below and right click &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/errortips/srcview/" target="_blank"&gt;view source&lt;/a&gt; to get the source code.  The error tips should stay in the correct position even when the input moves (from a window resize or layout).&lt;br /&gt;&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/errortips/ErrorTips.html?v=1.3.2" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="660" height="300"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;A lot of credit goes to Aral Balkin's blog entry on &lt;a href="http://aralbalkan.com/1125" target="_blank"&gt;Better form validation in Flex&lt;/a&gt;.  I also got help from this blog on &lt;a href="http://blog.flexmonkeypatches.com/2007/09/17/using-the-flex-tooltip-manager-to-create-error-tooltips-and-position-them/" target="_blank"&gt;how to show error tooltips&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Note that if you use the ErrorTipManager as described above and you set the &lt;code&gt;validator.enabled = false;&lt;/code&gt; then the error tip will still be displayed.  The validator does not fire an event when the enabled value changes, so it isn't possible to automatically update the visibility of the error tip.  Instead you can do it manually by calling &lt;code&gt;ErrorTipManager.hideErrorTip(validator.source, true)&lt;/code&gt;.  See the source code of the example above - I've added in a CheckBox that controls the second validator's enabled state.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;August 26th, 2009 update&lt;/b&gt;&lt;br /&gt;Fixed a problem where the error tip wasn't being position properly.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;November 2nd, 2009 update&lt;/b&gt;&lt;br /&gt;Added two new functions to &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/errortips/srcview/source/flex/utils/ui/validators/ErrorTipManager.as.html" target="_blank"&gt;ErrorTipManager&lt;/a&gt; for handling error tips in popup windows:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;code&gt;registerValidatorOnPopUp(validator, popUp, hideExistingErrorTips)&lt;/code&gt; - registers the validator and adds move and resize listeners on the popUp.  It can also hide any existing error tips (this is a good idea because the existing error tips appear on top of the popUp window which doesn't look good).&lt;/li&gt;&lt;li&gt;&lt;code&gt;unregisterPopUpValidators(popUp, validateExistingErrorTips)&lt;/code&gt; - unregisters all the validators associated with the popUp and removes the move and resize listeners that were added to the popUp.  It can also validate all the remaining validators which will cause the error tips to re-appear now that the popUp has closed.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;b&gt;March 24th, 2010 update&lt;/b&gt;&lt;br /&gt;Fixed a problem where the error tip wasn't being positioned properly when the parent container was scrolled.  It will also hide the error tip if the source component gets scrolled out of the view.  I also now move the error tip in front of other error tips when it gets positioned.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;July 14th, 2010 update&lt;/b&gt;&lt;br /&gt;Added two more event listeners in the &lt;b&gt;ErrorTipManager&lt;/b&gt; to listen for when the input is hidden (&lt;b&gt;visible="false"&lt;/b&gt;) and when it gets removed from its parent (&lt;b&gt;input.parent.removeChild(input)&lt;/b&gt;). &lt;br /&gt;This still does not solve the problem where the error tip remains visible when the parent is hidden or removed (e.g. if the input is inside a TabNavigator and the tab changes).  In this case I'd suggest manually hiding or removing the error tip.  Listen for the appropriate event like &lt;b&gt;"change"&lt;/b&gt; and then call &lt;b&gt;ErrorTipManager.hideErrorTip(input)&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;font color="#DD0000"&gt;&lt;b&gt;March 2011 update&lt;/b&gt;&lt;/font&gt;&lt;br /&gt;I've posted an alternate approach to displaying validation error messages that doesn't involve the rather hacky approach above. You can view the blog post &lt;a href="http://flexdevtips.blogspot.com/2011/03/spark-forms-validation-and-errors.html"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-4904548991535738752?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/4904548991535738752/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=4904548991535738752&amp;isPopup=true' title='61 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/4904548991535738752'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/4904548991535738752'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/08/always-showing-error-tips-validators.html' title='Always showing error tips (validators)'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>61</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-1026127175548387584</id><published>2009-07-29T15:35:00.000-07:00</published><updated>2012-01-27T14:49:57.912-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tooltips'/><category scheme='http://www.blogger.com/atom/ns#' term='helper classes'/><category scheme='http://www.blogger.com/atom/ns#' term='DataGridColumn'/><category scheme='http://www.blogger.com/atom/ns#' term='header'/><title type='text'>DataGridColumn header tooltips</title><content type='html'>I really thought that something as simple as putting a tooltip on a &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/dataGridClasses/DataGridColumn.html" target="_blank"&gt;DataGridColumn&lt;/a&gt; header would be easy to do in Flex.  &lt;br /&gt;&lt;br /&gt;If you want to make your own &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/dataGridClasses/DataGridColumn.html#headerRenderer" target="_blank"&gt;headerRenderer&lt;/a&gt;, then it is obviously very simple to just set the toolTip property in your renderer.  But I was curious if it could easily be done with out a custom header renderer.  My solution was to create a new class which extended &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/dataGridClasses/DataGridColumn.html" target="_blank"&gt;DataGridColumn&lt;/a&gt; and adds three new properties: &lt;b&gt;headerToolTip&lt;/b&gt;, &lt;b&gt;headerToolTipPosition&lt;/b&gt;, and &lt;b&gt;headerTextTruncate&lt;/b&gt; (which adds the "..." if the headerText is too long to fit).  &lt;br /&gt;&lt;br /&gt;Here is the simplified version of the MXML code:&lt;br /&gt;&lt;div class="code"&gt;&lt;font color="#0000ff"&gt;&amp;lt;mx:DataGrid &lt;/font&gt;&lt;font color="#000000"&gt;x=&lt;/font&gt;&lt;font color="#990000"&gt;"10"&lt;/font&gt; &lt;font color="#000000"&gt;y=&lt;/font&gt;&lt;font color="#990000"&gt;"10"&lt;/font&gt; &lt;font color="#000000"&gt;width=&lt;/font&gt;&lt;font color="#990000"&gt;"500"&lt;/font&gt; &lt;font color="#000000"&gt;height=&lt;/font&gt;&lt;font color="#990000"&gt;"130"&lt;/font&gt; &lt;font color="#000000"&gt;dataProvider=&lt;/font&gt;&lt;font color="#990000"&gt;"{employees}"&lt;/font&gt;&amp;gt;&lt;br/&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;&amp;lt;mx:columns&amp;gt;&lt;/font&gt;&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;&amp;lt;ui:DataGridToolTipColumn &lt;/font&gt;&lt;font color="#000000"&gt;headerText=&lt;/font&gt;&lt;font color="#990000"&gt;"Phone"&lt;/font&gt; &lt;font color="#000000"&gt;dataField=&lt;/font&gt;&lt;font color="#990000"&gt;"phone"&lt;/font&gt; &lt;font color="#000000"&gt;width=&lt;/font&gt;&lt;font color="#990000"&gt;"90"&lt;/font&gt;&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#000000"&gt;headerToolTip=&lt;/font&gt;&lt;font color="#990000"&gt;"Phone Number (tooltip above)"&lt;/font&gt; &lt;font color="#000000"&gt;headerToolTipPosition=&lt;/font&gt;&lt;font color="#990000"&gt;"above"&lt;/font&gt;&lt;font color="#0000ff"&gt;/&amp;gt;&lt;/font&gt;&lt;br/&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;&amp;lt;/mx:columns&amp;gt;&lt;/font&gt;&lt;br/&gt;&lt;font color="#0000ff"&gt;&amp;lt;/mx:DataGrid&amp;gt;&lt;/font&gt;&lt;/div&gt;&lt;br /&gt;The &lt;b&gt;&lt;u&gt;headerToolTipPosition&lt;/u&gt;&lt;/b&gt; property can have the following values:&lt;li&gt;&lt;b&gt;above&lt;/b&gt; - positions the tooltip above the header&lt;/li&gt;&lt;li&gt;&lt;b&gt;below&lt;/b&gt; - positions the tooltip below the header&lt;/li&gt;&lt;li&gt;&lt;b&gt;left&lt;/b&gt; - positions the tooltip to the left of the header&lt;/li&gt;&lt;li&gt;&lt;b&gt;right&lt;/b&gt; - positions the tooltip to the right of the header&lt;/li&gt;&lt;li&gt;&lt;b&gt;inline&lt;/b&gt; - positions the tooltip on top of the header&lt;/li&gt;&lt;li&gt;&lt;b&gt;default&lt;/b&gt; - positions the tooltip slightly below and to the right of the header (this is the default value if headerToolTipPosition isn't specified.&lt;/li&gt;&lt;br /&gt;And here is the example (right-click View Source for the full source code):&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/datagridtooltipcolumn/DataGridToolTipColumn.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="600" height="170"&gt;&lt;/iframe&gt;&lt;br /&gt;Feel free to use this code or modify it to your own needs.  &lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;font color="#660000"&gt;** Updated on September 16&lt;sup&gt;th&lt;/sup&gt; 2009&lt;/font&gt;&lt;/b&gt;&lt;br /&gt;&lt;li&gt;Fixed it so that setting &lt;b&gt;headerWordWrap="true"&lt;/b&gt; now works as expected.&lt;/li&gt;&lt;li&gt;When the &lt;b&gt;headerToolTip&lt;/b&gt; isn't defined then no tooltip is shown.&lt;/li&gt;&lt;li&gt;Added a new property: &lt;b&gt;headerTextTruncate&lt;/b&gt; which will truncate the headerText and add the ellipsis ("...") if the headerText doesn't fit inside the renderer.  Note that this property doesn't work if the headerWordWrap property is set to true.&lt;/li&gt;&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-1026127175548387584?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/1026127175548387584/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=1026127175548387584&amp;isPopup=true' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/1026127175548387584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/1026127175548387584'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/07/datagridcolumn-header-tooltips.html' title='DataGridColumn header tooltips'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-7655808059994252646</id><published>2009-06-30T17:22:00.000-07:00</published><updated>2012-01-27T14:42:22.271-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='swf'/><category scheme='http://www.blogger.com/atom/ns#' term='application'/><category scheme='http://www.blogger.com/atom/ns#' term='swfloader'/><category scheme='http://www.blogger.com/atom/ns#' term='parameters'/><category scheme='http://www.blogger.com/atom/ns#' term='remote'/><title type='text'>Loading Remote SWFs and parameters</title><content type='html'>Here is another example of one SWF loading another SWF and how parameters can be passed through the url.&lt;br /&gt;&lt;br /&gt;The main application (called Loader1) has a panel which displays information about the current application, parameters, url etc.&lt;br /&gt;&lt;br /&gt;The main application loads a remote application SWF (called Loader2) which also has the &lt;b&gt;same&lt;/b&gt; panel displaying information about the application, parameters, url, etc.  The differences are highlighted in bold.&lt;br /&gt;&lt;br /&gt;Here is the code for loading a remote swf - notice how parameters are passed into the url:&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;loadRemoteSWF&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;:&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;remoteSwfUrl:String&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;http://keg.cs.uvic.ca/flexdevtips/loaders/Loader2.swf?loaderurl=hello&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;loader:SWFLoader&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;SWFLoader&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;loader.addEventListener&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;Event.COMPLETE,&amp;nbsp;remoteSWFLoaded&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;loader.load&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;remoteSwfUrl&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;&lt;br/&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;remoteSWFLoaded&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;event:Event&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;:&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;loader:SWFLoader&amp;nbsp;=&amp;nbsp;event.currentTarget&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;as&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;SWFLoader;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;ui.addChild&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;loader.content&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&amp;nbsp;&lt;font color="#009900"&gt;//&amp;nbsp;ui&amp;nbsp;is&amp;nbsp;a&amp;nbsp;UIComponent&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;In the remote application you can access the parameters that were passed in from the main application through the &lt;A href="http://livedocs.adobe.com/flex/3/langref/mx/controls/SWFLoader.html" target="_blank"&gt;SWFLoader&lt;/a&gt; by the &lt;b&gt;parameters&lt;/b&gt; property, but you &lt;b&gt;MUST&lt;/b&gt; be inside the remote application MXML (e.g. in this case in Loader2.mxml), otherwise if you use &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/core/Application.html#parameters" target="_blank"&gt;Application.application.parameters&lt;/a&gt; this will refer to the parameters from the main application and not the ones that were passed in using the SWFLoader.&lt;br /&gt;&lt;iframe src="http://keg.cs.uvic.ca/flexdevtips/loaders/Loader1.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="640" height="440"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;Source Code&lt;/u&gt;&lt;/b&gt;:&lt;ul&gt;&lt;li&gt;&lt;a href="http://keg.cs.uvic.ca/flexdevtips/loaders/srcview/index.html" target="Loader1"&gt;Loader1 (Main Application)&lt;/a&gt;, or right click View Source&lt;/li&gt;&lt;li&gt;&lt;a href="http://keg.cs.uvic.ca/flexdevtips/loaders/srcview2/index.html" target="Loader2"&gt;Loader2 (Remote SWF Application)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-7655808059994252646?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/7655808059994252646/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=7655808059994252646&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7655808059994252646'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7655808059994252646'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/06/loading-remote-swfs-and-parameters.html' title='Loading Remote SWFs and parameters'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-7618574075085653984</id><published>2009-06-22T12:33:00.001-07:00</published><updated>2012-01-27T14:32:57.637-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Flex Library Project'/><category scheme='http://www.blogger.com/atom/ns#' term='ActionScript'/><category scheme='http://www.blogger.com/atom/ns#' term='rotation'/><category scheme='http://www.blogger.com/atom/ns#' term='fonts'/><category scheme='http://www.blogger.com/atom/ns#' term='defaults.css'/><category scheme='http://www.blogger.com/atom/ns#' term='embed'/><category scheme='http://www.blogger.com/atom/ns#' term='StyleSheet'/><title type='text'>Default stylesheet in an SWC (Flex Library Project), and embedded font rotation</title><content type='html'>For ages now I've been trying to figure out how I can use a StyleSheet from inside my &lt;b&gt;Flex Library Project&lt;/b&gt; in ActionScript.  I kept reading that it is very resource intensive to be calling &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/core/UIComponent.html#setStyle()" target="_blank"&gt;UIComponent.setStyle(...)&lt;/a&gt; at runtime, so I wanted to set all my styles using a StyleSheet.  The &lt;a href="http://livedocs.adobe.com/flex/3/html/help.html?content=styles_10.html" target="_blank"&gt;LiveDocs&lt;/a&gt; on the subject seem to say that there are two ways to load a StyleSheet:&lt;ol&gt;&lt;li&gt;From inside MXML in your Application using the &amp;lt;Style source="assets/styles.css"/&amp;gt; tag&lt;/li&gt;&lt;li&gt;By loading an external stylesheet SWF file (compiled from a CSS file) using the &lt;br /&gt;&lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/styles/StyleManager.html#loadStyleDeclarations()" target="_blank"&gt;StyleManager. loadStyleDeclarations(url)&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;Then I finally found the solution in this &lt;a href="http://parallaxed.net/article/css-type-selectors-are-not-supported-in-components?commented=1#c000072" target="_blank"&gt;article&lt;/a&gt; (right near the bottom of the page in the comment by Henk).  And that pointed me to this &lt;a style="font-size: 12pt; color: #aa0000" href="http://livedocs.adobe.com/flex/3/html/help.html?content=mxmlcomponents_4.html" target="_blank"&gt;LiveDoc - Applying styles to your custom component&lt;/a&gt; which solved the problem.  Scroll most of the way down until you get to the part called &lt;b&gt;"Applying styles from a defaults.css file"&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;If you don't want to read the articles above, here is my brief summary.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;Using a StyleSheet in your FlexLibrary Project&lt;/u&gt;&lt;/b&gt;:&lt;ol&gt;&lt;li&gt;create a StyleSheet in the &lt;b&gt;src&lt;/b&gt; directory of your project, and call it &lt;b&gt;defaults.css&lt;/b&gt;&lt;/li&gt;&lt;li&gt;open the project &lt;b&gt;Properties &amp;gt; Flex Library Build Path&lt;/b&gt; and check the src/defaults.css file under the &lt;b&gt;Assets&lt;/b&gt; tab&lt;/li&gt;&lt;li&gt;define your styles inside the defaults.css StyleSheet&lt;/li&gt;&lt;/ol&gt;&lt;b&gt;&lt;u&gt;Restrictions&lt;/u&gt;&lt;/b&gt;:&lt;ul&gt;&lt;li&gt;You can include only a single style sheet in the SWC file&lt;/li&gt;&lt;li&gt;The file must be named &lt;b&gt;defaults.css&lt;/b&gt;&lt;/li&gt;&lt;li&gt;The file must be in the top-most directory of the SWC file&lt;/li&gt;&lt;/ul&gt;*&lt;i&gt;Note&lt;/i&gt;: it appears that having a defaults.css file in your Flex Application project (swf) also works &lt;b&gt;without&lt;/b&gt; having to specify the stylesheet in the mxml (e.g. &amp;lt;mx:Style source="defaults.css"/&amp;gt; is not needed).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;&lt;span style="color:#aa0000;font-size:12;"&gt;Using Embedded Fonts inside Flex Library Project/SWC&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;:&lt;br /&gt;If you want to use an embedded font inside your library project you have two ways of doing this:&lt;ol&gt;&lt;li&gt;Embed the font inside an ActionScript file like this (the font is inside the project &lt;b&gt;src/assets&lt;/b&gt; directory):&lt;br /&gt;&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;&lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#000000"&gt;[&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;Embed&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;source=&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;'/assets/verdana.ttf'&lt;/b&gt;&lt;/font&gt;,&amp;nbsp;&lt;font color="#000000"&gt;fontName=&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;'localVerdana'&lt;/b&gt;&lt;/font&gt;,&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#000000"&gt;mimeType=&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;'application/x-font'&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)]&lt;/font&gt;&lt;br /&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;verdanaFont:Class;&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;...&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;setStyle&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;fontFamily&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;localVerdana&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;Or put your embedded &lt;b&gt;ttf&lt;/b&gt; font in your project's &lt;b&gt;src&lt;/b&gt; directory and embed the fond using the defaults.css file (the font must be in the src directory for this to work - see this &lt;a href="http://bugs.adobe.com/jira/browse/SDK-14908" target="_blank"&gt;Adobe Bug&lt;/a&gt; for more details):&lt;br /&gt;defaults.css:&lt;br /&gt;&lt;div class="code"&gt;&lt;font color="#990000"&gt;&lt;b&gt;@font-face&lt;/b&gt;&lt;/font&gt; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#330099"&gt;font-family&lt;/font&gt;: &lt;font color="#3333cc"&gt;localVerdana&lt;/font&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#330099"&gt;font-weight&lt;/font&gt;: &lt;font color="#3333cc"&gt;normal&lt;/font&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#330099"&gt;src&lt;/font&gt;: &lt;font color="#3333cc"&gt;url&lt;/font&gt;(&lt;font color="#990000"&gt;"verdana.ttf"&lt;/font&gt;);&lt;br /&gt;}&lt;br /&gt;&lt;font color="#ff00ff"&gt;.label&lt;/font&gt; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#999999"&gt;/* must use embedded font for label rotation to work */&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#330099"&gt;font-family&lt;/font&gt;: &lt;font color="#3333cc"&gt;localVerdana&lt;/font&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#999999"&gt;/* must specifically set the font weight */&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#330099"&gt;font-weight&lt;/font&gt;: &lt;font color="#3333cc"&gt;normal&lt;/font&gt;;&lt;br /&gt;}&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;Note that if you want to set the &lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/display/DisplayObject.html#rotation" target="_blank"&gt;DisplayObject.rotation&lt;/a&gt; property then you have to use an embedded font otherwise it doesn't work.&lt;br /&gt;&lt;br /&gt;Here is a simple example of font/label rotation (right click "View Source" for the code).&lt;br /&gt;In this example I actually included three fonts - &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/fontrotation/srcview/source/verdana.ttf"&gt;Verdana plain&lt;/a&gt;, &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/fontrotation/srcview/source/verdanab.ttf"&gt;Verdana bold&lt;/a&gt;, and &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/fontrotation/srcview/source/assets/comic.ttf"&gt;Comic Sans&lt;/a&gt;.&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/fontrotation/FontRotation.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="210" height="190"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;b&gt;* Note&lt;/b&gt; that fonts can greatly increase the size of your SWF.  The three fonts that I used above are all about 150 KB each.  One way to reduce the size of your SWF is to  restrict the unicode character range (meaning that only part of the font set is included in your SWF).  Here is the LiveDoc on &lt;a href="http://livedocs.adobe.com/flex/3/html/help.html?content=fonts_07.html" target="_blank"&gt;Using Fonts and Setting Character Ranges&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blog.benstucki.net/?p=40"&gt;Ben Stucki's blog&lt;/a&gt; helped me figure out how to embed a bold and plain font in CSS.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-7618574075085653984?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/7618574075085653984/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=7618574075085653984&amp;isPopup=true' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7618574075085653984'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7618574075085653984'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/06/default-stylesheet-in-swc-flex-library.html' title='Default stylesheet in an SWC (Flex Library Project), and embedded font rotation'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-119432502966529140</id><published>2009-06-20T21:51:00.000-07:00</published><updated>2009-06-20T23:23:06.184-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Resource Bundle RPC remote SWF'/><title type='text'>Error: Could not find resource bundle rpc</title><content type='html'>I ran into this runtime error &lt;b&gt;"Error: Could not find resource bundle rpc"&lt;/b&gt; when running my application which loads a remote SWF file. After a few futile Google searches (which turned up this &lt;a href="https://bugs.adobe.com/jira/browse/SDK-13945" target="_blank"&gt;bug report&lt;/a&gt;) I realized that I had compiled the remote SWF using the &lt;b&gt;Flex 2.0.1&lt;/b&gt; compiler instead of the default &lt;b&gt;Flex 3.2&lt;/b&gt;.  Once I changed my remote SWF to be compiled using the 3.2 compiler (this can be done under the project&lt;br&gt;&lt;b&gt;Properties &amp;gt; Flex Compiler &amp;gt; Use default SDK (currently "Flex 3.2")&lt;/b&gt; then it all worked as expected.  So I'm guessing that Flex 3 and Flex 2 SWFs don't play nicely...&lt;br /&gt;&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-119432502966529140?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/119432502966529140/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=119432502966529140&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/119432502966529140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/119432502966529140'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/06/error-could-not-find-resource-bundle.html' title='Error: Could not find resource bundle rpc'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-7951233474251732794</id><published>2009-06-17T13:22:00.000-07:00</published><updated>2012-01-27T14:30:06.352-08:00</updated><title type='text'>Creating a BevelFilter</title><content type='html'>It is remarkably simple to add a bevel filter to any &lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/display/DisplayObject.html#filters" target="_blank"&gt;DisplayObject&lt;/a&gt; using the &lt;b&gt;filters&lt;/b&gt; property.  You can also apply a bevel filter to a &lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/display/BitmapData.html#applyFilter()" target="_blank"&gt;BitmapData&lt;/a&gt; object by calling the &lt;b&gt;applyFilter()&lt;/b&gt; function.&lt;br /&gt;&lt;br /&gt;The two classes that you can use are: &lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/filters/BevelFilter.html" target="_blank"&gt;BevelFilter&lt;/a&gt; or &lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/filters/GradientBevelFilter.html" target="_blank"&gt;GradientBevelFilter&lt;/a&gt;.  In the example below I use the &lt;b&gt;BevelFilter&lt;/b&gt; because it is slightly more simple.  Almost all the properties are the same, except that the &lt;b&gt;GradientBevelFilter&lt;/b&gt; class lets you choose more than 2 colors, as well as the ratios and alpha values.  Here is a &lt;a href="http://livedocs.adobe.com/flex/3/html/help.html?content=Filtering_Visual_Objects_13.html" target="_blank"&gt;GradientBevelFilter example&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Here is an example that lets you set all the BevelFilter properties and see how it affects the image on to which the filter is applied.&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/bevelfilter/BevelFilterTest.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="635" height="330"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;Most of the properties are quite self explanatory.  The &lt;b&gt;quality&lt;/b&gt; property can be set using constants defined in the &lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/filters/BitmapFilterQuality.html" target="_blank"&gt;BitmapFilterQuality&lt;/a&gt; class (&lt;b&gt;high&lt;/b&gt; = 3, &lt;b&gt;medium&lt;/b&gt; = 2, and &lt;b&gt;low&lt;/b&gt; = 1).  But the &lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/filters/BevelFilter.html#quality" target="_blank"&gt;documentation&lt;/a&gt; also says that the allowed quality values are from 0 - 15, but you decrease the performance by setting the quality value higher than 3.&lt;br /&gt;There are also constants for the bevel type using the &lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/filters/BitmapFilterType.html" target="_blank"&gt;BitmapFilterType&lt;/a&gt; class.&lt;br /&gt;&lt;br /&gt;Adobe LiveDocs:&lt;ul&gt;&lt;li&gt;&lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/display/DisplayObject.html" target="_blank"&gt;DisplayObject&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/display/BitmapData.html" target="_blank"&gt;BitmapData&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/filters/BevelFilter.html" target="_blank"&gt;BevelFilter&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/filters/GradientBevelFilter.html" target="_blank"&gt;GradientBevelFilter&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/filters/BitmapFilterType.html" target="_blank"&gt;BitmapFilterType&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/filters/BitmapFilterQuality.html" target="_blank"&gt;BitmapFilterQuality&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;I'm also using the &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/binding/utils/BindingUtils.html" target="_blank"&gt;BindingUtils&lt;/a&gt; class to bind the bevel filter properties to the inputs (so that when the inputs change, the filter properties change too).&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-7951233474251732794?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/7951233474251732794/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=7951233474251732794&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7951233474251732794'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7951233474251732794'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/06/creating-bevelfilter.html' title='Creating a BevelFilter'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-6910219883794896801</id><published>2009-06-16T17:42:00.001-07:00</published><updated>2009-06-16T17:47:31.595-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='export swc oem'/><title type='text'>Unable to export SWC oem</title><content type='html'>Ever seen this error?  I just came across it today.  Thankfully the solution is very simple, but it took a few minutes of Google searches to find the solution.&lt;br /&gt;&lt;br /&gt;The problem is caused by having invalid assets selected in your Flex Library Project.  Probably you've removed one or more asset files, but the project properties didn't get updated.  &lt;br /&gt;To fix this open your project &lt;b&gt;Properties &amp;gt; Flex Library Build Path &amp;gt; Assets&lt;/b&gt;, then de-select all your assets, and then re-select the assets.  Click OK and it should update your project properties with the correct assets.&lt;br /&gt;&lt;br /&gt;Credits go to this useful website: &lt;a href="http://www.flexgarden.net/wiki/FlexChytaky"&gt;FlexGarden.net&lt;/a&gt;&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-6910219883794896801?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/6910219883794896801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=6910219883794896801&amp;isPopup=true' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/6910219883794896801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/6910219883794896801'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/06/unable-to-export-swc-oem.html' title='Unable to export SWC oem'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-5987632689230857288</id><published>2009-06-13T21:07:00.001-07:00</published><updated>2009-06-22T13:05:50.189-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='full screen'/><title type='text'>Full Screen support in Flex</title><content type='html'>I recently learned that you can make your Flex application full screen.  Here are the steps to accomplish it:&lt;br /&gt;&lt;br /&gt;First edit your project's &lt;b&gt;html-template/index.template.html&lt;/b&gt; file and add the following &lt;b&gt;allowFullScreen&lt;/b&gt; property to the JavaScript code:&lt;br /&gt;&lt;div class="code"&gt;else if (hasRequestedVersion) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;AC_FL_RunContent(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;...&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;b&gt;"allowFullScreen","true",&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;...&lt;br /&gt;);&lt;/div&gt;&lt;br /&gt;You can also add the &lt;b&gt;&amp;lt;param name="allowFullScreen" value="true"/&amp;gt;&lt;/b&gt; to the &lt;b&gt;&amp;lt;object&amp;gt;&lt;/b&gt; tag, and &lt;b&gt;allowFullScreen="true"&lt;/b&gt; to the &lt;b&gt;&amp;lt;embed&amp;gt;&lt;/b&gt; tag for compatibility.&lt;br /&gt;&lt;br /&gt;Next in your ActionScript code when the application has finished loading (when the &lt;b&gt;stage&lt;/b&gt; isn't null) you can make your application full screen like this:&lt;br /&gt;&lt;div class="code"&gt;Application.application.stage.displayState = StageDisplayState.FULL_SCREEN;&lt;/div&gt;&lt;br /&gt;I found this out from the &lt;a href="http://livedocs.adobe.com/flex/3/progAS_flex3.pdf" target="_blank"&gt;The Adobe Flex 3 Programming ActionScript 3 PDF&lt;/a&gt; on page 547.&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-5987632689230857288?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/5987632689230857288/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=5987632689230857288&amp;isPopup=true' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/5987632689230857288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/5987632689230857288'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/06/full-screen-support-in-flex.html' title='Full Screen support in Flex'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-4403236102919269225</id><published>2009-06-11T16:59:00.000-07:00</published><updated>2012-01-27T11:40:26.544-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Web Service'/><category scheme='http://www.blogger.com/atom/ns#' term='Amazon'/><title type='text'>Flex Amazon Image Search</title><content type='html'>Here's a sample application that queries the Amazon Web Services to retrieve images for CDs, DVDs, books, video games, software, etc.  E.g. if you want to find the album cover for a music CD.  &lt;br /&gt;&lt;br /&gt;Here is my example - it lets you search for music, dvds, books, etc by title (and an artist for music cds, and an author for books) and then shows the resulting images ordered into 5 different image sizes.  &lt;i&gt;Double click&lt;/i&gt; an image to open the jpg in a new window.&lt;br /&gt;&lt;font color="#663399"&gt;&lt;b&gt;**&lt;/b&gt; As Amazon keeps updating their web service this example will stop working.  Please view the source code to see how it used to work!&lt;br&gt;&lt;/font&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/amazonimagesearch/AmazonImagesSearch.html?v=1.1" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="600" height="500"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;Here are the steps to get it working in your Flex Builder:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Download the source code from the example above (Right click "View Source", then click the download link in the bottom left corner of the page)&lt;/li&gt;&lt;li&gt;Sign up for an &lt;A href="https://aws-portal.amazon.com/gp/aws/developer/account/index.html?ie=UTF8&amp;action=access-key" target="_blank"&gt;Amazon Web Service Account&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Copy your Access Key ID and put it in the &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/amazonimagesearch/srcview/source/services/AmazonItemSearch.as.html" target="_blank"&gt;services/AmazonItemSearch.as&lt;/a&gt; file&lt;/li&gt;&lt;li&gt;Full details and the API for the Amazon Web Services are located &lt;a href="http://docs.amazonwebservices.com/AWSECommerceService/2009-07-01/DG/index.html?APPNDX_SearchIndexParamForItemsearch.html" target="_blank"&gt;here&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;I found this website which helped me get started:&lt;br /&gt;&lt;A href="http://blog.iconara.net/2007/06/10/finding-cover-art-with-flex-and-amazon-webservices/"&gt;Finding cover art with Flex and Amazon WebServices&lt;/a&gt;.&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;&lt;font color="#990000"&gt;&lt;b&gt;&lt;u&gt;** August 24th, 2009 Update **&lt;/u&gt;&lt;/b&gt;&lt;/font&gt;&lt;br /&gt;As of August 15th Amazon now requires that all requests are signed.  The example above has been updated to include this change, so you can &lt;a href="srcview" target="_blank"&gt;View Source&lt;/a&gt; to see the code.&lt;br /&gt;&lt;br /&gt;Here are some links that I found very useful in fixing the problem:&lt;ul&gt;&lt;li&gt;&lt;a href="http://docs.amazonwebservices.com/AWSECommerceService/2009-07-01/GSG/index.html?SubmittingYourFirstRequest.html" target="_blank"&gt;Getting Started - submitting your first request&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://docs.amazonwebservices.com/AWSECommerceService/2009-07-01/DG/index.html?rest-signature.html" target="_blank"&gt;Example REST Requests (steps on how to sign the request)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://associates-amazon.s3.amazonaws.com/signed-requests/helper/index.html" target="_blank"&gt;Signed Request Helper&lt;/a&gt;:&lt;br /&gt;Use &lt;b&gt;00000000000000000000&lt;/b&gt; for the access key and &lt;b&gt;1234567890&lt;/b&gt; for the secret key.&lt;br /&gt;Then copy the following text into the Unsigned URL textbox:&lt;div class="code"&gt;http://webservices.amazon.com/onca/xml?Service=AWSECommerceServic&lt;br /&gt;e&amp;AWSAccessKeyId=00000000000000000000&amp;Operation=ItemLookup&amp;ItemId&lt;br /&gt;=0679722769&amp;ResponseGroup=ItemAttributes,Offers,Images,Reviews&amp;Ve&lt;br /&gt;rsion=2009-01-06&amp;Timestamp=2009-01-01T12:00:00Z&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;b&gt;&lt;u&gt;** One final note&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;When signing the request, I tried using the &lt;b&gt;com.adobe.crypto.HMAC&lt;/b&gt; and &lt;b&gt;com.adobe.crypto.SHA256&lt;/b&gt; classes that come with the &lt;a href="http://code.google.com/p/as3corelib/" target="_blank"&gt;as3corelib&lt;/a&gt; project to create the signature, but it didn't work because the signature needs to be Base64 encoded.  So instead I modified those two classes very slightly to make it work. &lt;br /&gt;&lt;br /&gt;I also included a &lt;b&gt;TestSignature.mxml&lt;/b&gt; application which was useful to make sure that the signature matched what the &lt;a href="http://associates-amazon.s3.amazonaws.com/signed-requests/helper/index.html" target="_blank"&gt;Signed Request Helper&lt;/a&gt; output.&lt;br /&gt;&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-4403236102919269225?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/4403236102919269225/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=4403236102919269225&amp;isPopup=true' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/4403236102919269225'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/4403236102919269225'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/06/flex-amazon-image-search.html' title='Flex Amazon Image Search'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-6791727388987524056</id><published>2009-06-04T12:10:00.001-07:00</published><updated>2012-01-27T11:37:00.560-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='M'/><category scheme='http://www.blogger.com/atom/ns#' term='Zen'/><category scheme='http://www.blogger.com/atom/ns#' term='firmware'/><category scheme='http://www.blogger.com/atom/ns#' term='60gb'/><category scheme='http://www.blogger.com/atom/ns#' term='motherboard'/><category scheme='http://www.blogger.com/atom/ns#' term='ZVM'/><category scheme='http://www.blogger.com/atom/ns#' term='Vision'/><category scheme='http://www.blogger.com/atom/ns#' term='Creative'/><title type='text'>Repairing my Creative Zen Vision:M 60GB (not Flex related)</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://chris.firlingcanada.com/flexdevtips/zvm/zen.jpg"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 136px; height: 136px;" src="http://chris.firlingcanada.com/flexdevtips/zvm/zen.jpg" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;I've spent many hours this year trying to fix my &lt;a href="http://support.creative.com/Products/ProductDetails.aspx?catID=213&amp;CatName=MP3+Players&amp;subCatID=214&amp;subCatName=ZEN&amp;prodID=14331&amp;prodName=ZEN+Vision:M" target="_blank"&gt;Creative Zen Vision:M 60GB&lt;/a&gt;.  It died in January after I connected it to my laptop to charge it up (using a cheap adapter that I bought on ebay).  Ever since it wouldn't turn on, just had a solid blue light (or a blinking blue light when it was plugged in to the computer or wall charger).  And it was not recognized by the computer either.&lt;br /&gt;&lt;br /&gt;My first thought was that the motherboard had died (probably because of my cheap usb adapter cable), but motherboards are quite expensive to replace, so instead I bought a new battery (off ebay too!) just to make sure.  When the battery arrived I installed it and nothing changed - exactly the same scenario.  So then I went back on ebay and bought a motherboard (not as expensive as I thought - only $20 USD plus shipping).  The motherboard arrived this week and I took the old one out and put the new one in.  See below for links on how to disassemble the ZVM.  It isn't that difficult as long as you have a tiny Phillips screw driver, and steady hands. &lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://chris.firlingcanada.com/flexdevtips/zvm/zen_motherboard.jpg"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 300px; height: 226px;" src="http://chris.firlingcanada.com/flexdevtips/zvm/zen_motherboard.jpg" border="0" alt="" /&gt;&lt;/a&gt; &lt;br /&gt;After the new motherboard was installed I first connected it to the computer with the real cables that came with the player and charged it up.  The computer instantly recognized mp3 player, and installed the drivers for it.  But when I went to the properties in Windows Explorer it said it was only 50mb (instead of 60gb!).  After searching google it appears that many other people have had this scenario.  The reason for it is the firmware isn't correctly loaded, or is out of date, or the hard drive is faulty.  &lt;br /&gt;&lt;br /&gt;When I turned on the mp3 player the screen then showed an error message saying incorrect firmware version (0.0.15) and gave me the option to clean , format, reload firmware, and reboot.  Cleaning did nothing - the screen said "scan disk..." forever. So I tried to reload the firmware.  I downloaded the latest version from the Creative support website (linked at the top) and ran the exe (version 1.21.02), but every time it said &lt;b&gt;"Your player is not connected.  Please connect your player."&lt;/b&gt; even though my player was connected AND was recognized by Windows Explorer.  A few people mention that this error happens on Windows XP when you have Windows Media Player 11 installed, so I rolled back to Windows Media Player 10 and still the same problem.&lt;br /&gt;&lt;br /&gt;So, next step was to find a way to get the firmware onto the player with out using Creative's default firmware updater.  I came across a support forum on &lt;a href="http://www.epizenter.net"&gt;www.epizenter.net&lt;/a&gt; mentioning that some people had hacked/cracked the Zen Vision:M firmware and had been able to change the fonts, colors, themes etc.  So after days of searching I finally found some tools which helped me fix my zen.  I haven't been able to find an original version of my 60gb firmware, so instead I'm using a modified version that uses a different font (Comic Sans MS).  It works, so I don't care :)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Here are the steps I followed:&lt;/b&gt;&lt;ol&gt;&lt;li&gt;Download the hacked &lt;a href="http://chris.firlingcanada.com/flexdevtips/zvm/ZENVisionM_30GB_Firmware_updater.exe"&gt;Firmware Updater&lt;/a&gt; (it is for the ZVM 30gb but also works with the 60gb)&lt;/li&gt;&lt;li&gt;Download the modified firmware &lt;a href="http://chris.firlingcanada.com/flexdevtips/zvm/nk.bin"&gt;nk.bin&lt;/a&gt; and put it in this directory (on Windows) &lt;b&gt;C:\CtJbFW\newbin&lt;/b&gt;&lt;/li&gt;&lt;li&gt;Connect your zen, and run the updater.  All being well it will update the firmware and reboot your zen and it will work!&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Links:&lt;/b&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://support.creative.com/Products/ProductDetails.aspx?catID=213&amp;CatName=MP3+Players&amp;subCatID=214&amp;subCatName=ZEN&amp;prodID=14331&amp;prodName=ZEN+Vision:M"&gt;Creative Zen Vision:M homepage&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.anythingbutipod.com/forum/forumdisplay.php?f=19"&gt;anythingbutipod.com - an awesome website&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.epizenter.net"&gt;Epizenter.net - another amazing resource for Creative Zen products&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.rockbox.org/twiki/bin/view/Main/CreativeZVMPort#Port_Status"&gt;Rockbox - Creative ZVM Port&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.anythingbutipod.com/forum/showthread.php?t=22291"&gt;anythingbutipod.com - Creative Zen Vision M Firmware Cracked&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.epizenter.net/e107_plugins/forum/forum_viewtopic.php?69697.0"&gt;Epizenter.net - ZVM Firmware Mod Thread&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.anythingbutipod.com/archives/2006/02/how-to-disassemble-the-creative-zen-vision-m.php"&gt;Anythingbutipod - How to Disassemble the Creative Zen Vision:M&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;I've recently bought the new Creative Zen X-Fi2 mp3 player, with the touchscreen interface.  At first it was a little sluggish (the touchscreen), but Creative has released a few patches that greatly improve the performance.  &lt;br /&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;iframe src="http://rcm.amazon.com/e/cm?t=fle07-20&amp;o=1&amp;p=8&amp;l=bpl&amp;asins=B000CS7U1C&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;m=amazon&amp;lc1=0000FF&amp;bc1=000000&amp;bg1=FFFFFF&amp;f=ifr" style="align:left;padding-top:5px;width:131px;height:245px;padding-right:10px;" align="left" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;iframe src="http://rcm.amazon.com/e/cm?t=fle07-20&amp;o=1&amp;p=8&amp;l=bpl&amp;asins=B002NKLRES&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;m=amazon&amp;lc1=0000FF&amp;bc1=000000&amp;bg1=FFFFFF&amp;f=ifr" style="align:left;padding-top:5px;width:131px;height:245px;padding-right:10px;" align="left" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;iframe src="http://rcm.amazon.com/e/cm?t=fle07-20&amp;o=1&amp;p=8&amp;l=bpl&amp;asins=B002NKLRF2&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;m=amazon&amp;lc1=0000FF&amp;bc1=000000&amp;bg1=FFFFFF&amp;f=ifr" style="align:left;padding-top:5px;width:131px;height:245px;padding-right:10px;" align="left" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-6791727388987524056?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/6791727388987524056/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=6791727388987524056&amp;isPopup=true' title='19 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/6791727388987524056'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/6791727388987524056'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/06/repairing-my-creative-zen-visionm-60gb.html' title='Repairing my Creative Zen Vision:M 60GB (not Flex related)'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>19</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-4816904303101127776</id><published>2009-05-27T15:03:00.000-07:00</published><updated>2012-01-27T11:35:10.151-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='blogger'/><category scheme='http://www.blogger.com/atom/ns#' term='line numbers'/><category scheme='http://www.blogger.com/atom/ns#' term='syntax highlighting'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><title type='text'>Blogger source code syntax highlighting</title><content type='html'>If you've read my last few blog posts you might have noticed that my code snippets now have syntax highlighting that looks similar to Flex Builder. &lt;br /&gt;&lt;br /&gt;I've found many people asking how to get syntax highlighting to work on source code that is pasted into Blogger.  Most solutions use CSS and Javascript to accomplish that with varying levels of success.  I've chosen to go a different route and am using a parser to turn ActionScript text into html which I then paste right into a blog post (under "Edit Html").  &lt;br /&gt;&lt;br /&gt;I'm using a slightly modified version of this amazing free parser called &lt;a href="http://www.java2html.de/" target="_blank"&gt;Java2Html&lt;/a&gt; created by Markus Gebhard (GNU License).  It is a Java Swing application (or Applet) that takes in input text and outputs html which you can easily copy and paste into a blog.  The original version (which I believe is last updated in 2006) has three different style options - Eclipse, Kawa, and Monochrome.  I've added a fourth option FlexBuilder that uses the default syntax highlighting styles found in ActionScript.  &lt;br /&gt;&lt;br /&gt;If you want to try out my version, I've posted the applet here: &lt;A href="http://chris.firlingcanada.com/flexdevtips/java2html/" target="_blank"&gt;java2html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here are some of the options you can use (in the panel on the right side):&lt;br /&gt;&lt;li&gt;Style - choose one of the 4 code styles (use &lt;b&gt;FlexBuilder&lt;/b&gt; for ActionScript)&lt;/li&gt;&lt;li&gt;Line numbers - shows line numbers in the html&lt;/li&gt;&lt;li&gt;Table border - draws a 2 pixel gray border around the code block&lt;/li&gt;&lt;li&gt;Background color - if checked then a white background color is set on the code block&lt;/li&gt;&lt;li&gt;Include &amp;lt;html&amp;gt; and &amp;lt;body&amp;gt; tags - if false then the output html doesn't inclde the &amp;lt;html&amp;gt; and &amp;lt;body&amp;gt; tags, only the content.&lt;/li&gt;&lt;li&gt;Use &amp;lt;br&amp;gt; at the end of lines - if false then the html won't contain &amp;lt;br&amp;gt; tags&lt;/li&gt;&lt;li&gt;Include new lines ("\n") - if false then the html won't contain new line characters. &lt;b&gt;&lt;i&gt;Turn this off if you want to paste your code into Blogger since it treats new lines as breaks!&lt;/i&gt;&lt;/b&gt;&lt;/li&gt;&lt;li&gt;CSS Class - by default the code block is wrapped inside a &amp;lt;div class="java"&amp;gt; tag.  This option configures the class="java" part.&lt;/li&gt;&lt;br /&gt;Again I can't take much credit for this.  All I've really done is add a few of the options mentioned above and changed the parser slightly to work with ActionScript keywords (such as function, var, etc).&lt;br /&gt;&lt;br /&gt;Here is an example of a very simple code snippet with and without styling:&lt;br /&gt;&lt;table cellspacing="5"&gt;&lt;tr&gt;&lt;td valign="top" class="code"&gt;private function get string():String {&lt;br /&gt;    var str:String = "String";&lt;br /&gt;    return str;&lt;br /&gt;}&lt;/td&gt;&lt;td valign="top" class="code"&gt;&lt;table border="0" cellpadding="0" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;get&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;string&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;:String&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;str:String&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;String&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;return&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;str;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;}&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;One more thing, I haven't tested the various &lt;b&gt;Target&lt;/b&gt; options, I only use the default "XHTML 1.0 Transitional (inlined fonts)".  &lt;br /&gt;&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-4816904303101127776?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/4816904303101127776/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=4816904303101127776&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/4816904303101127776'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/4816904303101127776'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/05/blogger-source-code-syntax-highlighting.html' title='Blogger source code syntax highlighting'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-7074351615520711748</id><published>2009-05-26T10:51:00.000-07:00</published><updated>2009-05-27T14:58:23.394-07:00</updated><title type='text'>Sorting string characters alphabetically</title><content type='html'>In Java if you want to sort the characters in a String alphabetically it is very easy:&lt;br /&gt;&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#000000"&gt;String&amp;nbsp;test&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#2a00ff"&gt;&amp;#34;sorting&amp;#34;&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;char&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;[]&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;chars&amp;nbsp;=&amp;nbsp;test.toCharArray&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;Arrays.sort&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;chars&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;System.out.println&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#7f0055"&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;String&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;chars&lt;/font&gt;&lt;font color="#000000"&gt;))&lt;/font&gt;&lt;font color="#000000"&gt;;&amp;nbsp;&lt;/font&gt;&lt;font color="#3f7f5f"&gt;//&amp;nbsp;prints&amp;nbsp;out&amp;nbsp;&amp;#34;ginorst&amp;#34;&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;But how can we do this in Flex/ActionScript?  Perhaps there is an easier way than this, but here are my utility functions that sorts the characters in a String by putting each character into an array, sorting the array, then joining the array back into a String.&lt;br /&gt;&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#3f5fbf"&gt;/**&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;*&amp;nbsp;Converts&amp;nbsp;the&amp;nbsp;string's&amp;nbsp;characters&amp;nbsp;into&amp;nbsp;an&amp;nbsp;array.&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;*&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;&lt;b&gt;@param&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;string&amp;nbsp;the&amp;nbsp;string&amp;nbsp;to&amp;nbsp;convert&amp;nbsp;into&amp;nbsp;an&amp;nbsp;array&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;*&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;&lt;b&gt;@param&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;unique&amp;nbsp;if&amp;nbsp;true&amp;nbsp;then&amp;nbsp;only&amp;nbsp;unique&amp;nbsp;characters&amp;nbsp;are&amp;nbsp;added&amp;nbsp;to&amp;nbsp;the&amp;nbsp;array&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;*&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;&lt;b&gt;@param&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;ignoreCase&amp;nbsp;only&amp;nbsp;applies&amp;nbsp;if&amp;nbsp;the&amp;nbsp;unique&amp;nbsp;property&amp;nbsp;is&amp;nbsp;set&amp;nbsp;to&amp;nbsp;true&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;*/&lt;/font&gt;&lt;br/&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;public&amp;nbsp;static&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;toCharArray&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;string:String,&amp;nbsp;unique:Boolean&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;false&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;ignoreCase:Boolean&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;false&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;:Array&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;array:Array&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;Array&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;if&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;((&lt;/font&gt;&lt;font color="#000000"&gt;string&amp;nbsp;!=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;&amp;amp;&amp;amp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;string.length&amp;nbsp;&amp;gt;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;))&amp;nbsp;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;for&amp;nbsp;tracking&amp;nbsp;unique&amp;nbsp;letters&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;seen:Object&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;Object&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;add&amp;nbsp;each&amp;nbsp;character&amp;nbsp;to&amp;nbsp;the&amp;nbsp;array&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;for&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;i:int&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;;&amp;nbsp;i&amp;nbsp;&amp;lt;&amp;nbsp;string.length;&amp;nbsp;i++&lt;/font&gt;&lt;font color="#000000"&gt;)&amp;nbsp;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;char:String&amp;nbsp;=&amp;nbsp;string.charAt&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;i&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;if&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;unique&lt;/font&gt;&lt;font color="#000000"&gt;)&amp;nbsp;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;unique&amp;nbsp;characters&amp;nbsp;only,&amp;nbsp;possibly&amp;nbsp;ignoring&amp;nbsp;case&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;use&amp;nbsp;the&amp;nbsp;character&amp;nbsp;code&amp;nbsp;as&amp;nbsp;the&amp;nbsp;key&amp;nbsp;(could&amp;nbsp;just&amp;nbsp;use&amp;nbsp;the&amp;nbsp;letter&amp;nbsp;too)&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;key:String&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;ignoreCase&amp;nbsp;?&amp;nbsp;char.toUpperCase&lt;/font&gt;&lt;font color="#000000"&gt;()&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;:&amp;nbsp;char&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;key&amp;nbsp;=&amp;nbsp;key.charCodeAt&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;.toString&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;10&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;if&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;!seen.hasOwnProperty&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;key&lt;/font&gt;&lt;font color="#000000"&gt;))&amp;nbsp;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;seen&lt;/font&gt;&lt;font color="#000000"&gt;[&lt;/font&gt;&lt;font color="#000000"&gt;key&lt;/font&gt;&lt;font color="#000000"&gt;]&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;true&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;array.push&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;char&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;else&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;array.push&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;char&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;return&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;array;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;&lt;br/&gt;&lt;font color="#3f5fbf"&gt;/**&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;*&amp;nbsp;Sorts&amp;nbsp;the&amp;nbsp;characters&amp;nbsp;in&amp;nbsp;the&amp;nbsp;string&amp;nbsp;alphabetically.&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;*&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;&lt;b&gt;@param&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;ignoreCase&amp;nbsp;if&amp;nbsp;false&amp;nbsp;(default)&amp;nbsp;upper&amp;nbsp;case&amp;nbsp;letters&amp;nbsp;come&amp;nbsp;first&amp;nbsp;then&amp;nbsp;lowercase&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;*&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;&lt;b&gt;@param&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;descending&amp;nbsp;if&amp;nbsp;true&amp;nbsp;then&amp;nbsp;the&amp;nbsp;String&amp;nbsp;is&amp;nbsp;sorted&amp;nbsp;in&amp;nbsp;reverse&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;*&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;&lt;b&gt;@param&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;unique&amp;nbsp;if&amp;nbsp;true&amp;nbsp;then&amp;nbsp;only&amp;nbsp;unique&amp;nbsp;characters&amp;nbsp;are&amp;nbsp;sorted&amp;nbsp;and&amp;nbsp;returned&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&lt;/font&gt;&lt;font color="#3f5fbf"&gt;*/&lt;/font&gt;&lt;br/&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;public&amp;nbsp;static&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;sort&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;string:String,&amp;nbsp;ignoreCase:Boolean&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;false&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;descending:Boolean&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;false&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;unique:Boolean&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;false&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;:String&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;no&amp;nbsp;point&amp;nbsp;in&amp;nbsp;sorting&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;if&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;((&lt;/font&gt;&lt;font color="#000000"&gt;string&amp;nbsp;==&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;||&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;string.length&amp;nbsp;&amp;lt;=&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;1&lt;/font&gt;&lt;font color="#000000"&gt;))&amp;nbsp;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;return&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;string;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;chars:Array&amp;nbsp;=&amp;nbsp;toCharArray&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;string,&amp;nbsp;unique,&amp;nbsp;ignoreCase&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;options:uint&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;if&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;ignoreCase&lt;/font&gt;&lt;font color="#000000"&gt;)&amp;nbsp;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;options&amp;nbsp;=&amp;nbsp;options&amp;nbsp;|&amp;nbsp;Array.CASEINSENSITIVE;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;if&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;descending&lt;/font&gt;&lt;font color="#000000"&gt;)&amp;nbsp;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;options&amp;nbsp;=&amp;nbsp;options&amp;nbsp;|&amp;nbsp;Array.DESCENDING;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;chars.sort&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;s1:String,&amp;nbsp;s2:String&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;:int&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;return&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;ObjectUtil.stringCompare&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;s1,&amp;nbsp;s2,&amp;nbsp;ignoreCase&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;options&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;sorted:String&amp;nbsp;=&amp;nbsp;chars.join&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;return&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;sorted;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;Feel free to comment if you know of a simpler way to sort characters in a String.&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-7074351615520711748?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/7074351615520711748/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=7074351615520711748&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7074351615520711748'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7074351615520711748'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/05/sorting-string-characters.html' title='Sorting string characters alphabetically'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-7114769816698422875</id><published>2009-05-20T12:53:00.001-07:00</published><updated>2010-04-23T17:38:08.816-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='remoteobject'/><category scheme='http://www.blogger.com/atom/ns#' term='amfphp'/><category scheme='http://www.blogger.com/atom/ns#' term='remoting'/><title type='text'>Using Flex and AMFPHP without a services-config.xml file</title><content type='html'>I've been working a bit with &lt;a href="http://www.amfphp.org/" target="_blank"&gt;amfphp&lt;/a&gt;, sending data between Flex and PHP using the &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/rpc/remoting/RemoteObject.html"&gt;RemoteObject&lt;/a&gt; class. Initially I put the generic &lt;b&gt;services-config.xml&lt;/b&gt; file in my application's src directory:&lt;pre style="background-color: #F0F0DD;"&gt;&lt;font color="#0000ff"&gt;&amp;lt;services-config&amp;gt;&lt;/font&gt;&lt;br/&gt;    &lt;font color="#0000ff"&gt;&amp;lt;services&amp;gt;&lt;/font&gt;&lt;br/&gt;        &lt;font color="#0000ff"&gt;&amp;lt;service &lt;/font&gt;&lt;font color="#000000"&gt;id=&lt;/font&gt;&lt;font color="#990000"&gt;"amfphp-flashremoting-service"&lt;/font&gt; &lt;br/&gt;            &lt;font color="#000000"&gt;class=&lt;/font&gt;&lt;font color="#990000"&gt;"flex.messaging.services.RemotingService"&lt;/font&gt; &lt;br/&gt;            &lt;font color="#000000"&gt;messageTypes=&lt;/font&gt;&lt;font color="#990000"&gt;"flex.messaging.messages.RemotingMessage"&lt;/font&gt;&amp;gt;&lt;br/&gt;            &lt;font color="#0000ff"&gt;&amp;lt;destination &lt;/font&gt;&lt;font color="#000000"&gt;id=&lt;/font&gt;&lt;font color="#990000"&gt;"amfphp"&lt;/font&gt;&amp;gt;&lt;br/&gt;                &lt;font color="#0000ff"&gt;&amp;lt;channels&amp;gt;&lt;/font&gt;&lt;br/&gt;                    &lt;font color="#0000ff"&gt;&amp;lt;channel &lt;/font&gt;&lt;font color="#000000"&gt;ref=&lt;/font&gt;&lt;font color="#990000"&gt;"my-amfphp"&lt;/font&gt;&lt;font color="#0000ff"&gt;/&amp;gt;&lt;/font&gt;&lt;br/&gt;                &lt;font color="#0000ff"&gt;&amp;lt;/channels&amp;gt;&lt;/font&gt;&lt;br/&gt;                &lt;font color="#0000ff"&gt;&amp;lt;properties&amp;gt;&lt;/font&gt;&lt;br/&gt;                    &lt;font color="#0000ff"&gt;&amp;lt;source&amp;gt;&lt;/font&gt;*&lt;font color="#0000ff"&gt;&amp;lt;/source&amp;gt;&lt;/font&gt;&lt;br/&gt;                &lt;font color="#0000ff"&gt;&amp;lt;/properties&amp;gt;&lt;/font&gt;&lt;br/&gt;            &lt;font color="#0000ff"&gt;&amp;lt;/destination&amp;gt;&lt;/font&gt;&lt;br/&gt;        &lt;font color="#0000ff"&gt;&amp;lt;/service&amp;gt;&lt;/font&gt;&lt;br/&gt;    &lt;font color="#0000ff"&gt;&amp;lt;/services&amp;gt;&lt;/font&gt;&lt;br/&gt;    &lt;font color="#0000ff"&gt;&amp;lt;channels&amp;gt;&lt;/font&gt;&lt;br/&gt;        &lt;font color="#0000ff"&gt;&amp;lt;channel-definition &lt;/font&gt;&lt;font color="#000000"&gt;id=&lt;/font&gt;&lt;font color="#990000"&gt;"my-amfphp"&lt;/font&gt; &lt;font color="#000000"&gt;class=&lt;/font&gt;&lt;font color="#990000"&gt;"mx.messaging.channels.AMFChannel"&lt;/font&gt;&amp;gt;&lt;br/&gt;            &lt;font color="#0000ff"&gt;&amp;lt;endpoint &lt;/font&gt;&lt;font color="#000000"&gt;uri=&lt;/font&gt;&lt;font color="#990000"&gt;"http://localhost/amfphp/gateway.php"&lt;/font&gt;&lt;br/&gt;                      &lt;font color="#000000"&gt;class=&lt;/font&gt;&lt;font color="#990000"&gt;"flex.messaging.endpoints.AMFEndpoint"&lt;/font&gt;&lt;font color="#0000ff"&gt;/&amp;gt;&lt;/font&gt;&lt;br/&gt;        &lt;font color="#0000ff"&gt;&amp;lt;/channel-definition&amp;gt;&lt;/font&gt;&lt;br/&gt;    &lt;font color="#0000ff"&gt;&amp;lt;/channels&amp;gt;&lt;/font&gt;&lt;br/&gt;&lt;font color="#0000ff"&gt;&amp;lt;/services-config&amp;gt;&lt;/font&gt;&lt;/pre&gt;And changed my project properties to add this line to the &lt;b&gt;Flex Compiler&lt;/b&gt; page:&lt;br /&gt;&lt;code&gt;-services services-config.xml&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;But I just came across this &lt;a href="http://gertonscorner.wordpress.com/2008/09/06/remoteobject-using-amfphp-and-actionscript-3/" target="_blank"&gt;post&lt;/a&gt; which shows how to get around having to have an XML file by defining the channel at runtime.&lt;br /&gt;&lt;br /&gt;So here is my simplified &lt;b&gt;Flex&lt;/b&gt; code:&lt;br /&gt;&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;&lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;import&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;mx.rpc.events.ResultEvent;&lt;/font&gt;&lt;br /&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;import&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;mx.rpc.events.FaultEvent;&lt;/font&gt;&lt;br /&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;import&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;mx.rpc.remoting.RemoteObject;&lt;/font&gt;&lt;br /&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;import&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;mx.messaging.ChannelSet;&lt;/font&gt;&lt;br /&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;import&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;mx.messaging.channels.AMFChannel;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;url:String&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;http://localhost/amfphp/gateway.php&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;channel:AMFChannel&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;AMFChannel&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;my-amfphp&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;url&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;channelSet:ChannelSet&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;ChannelSet&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;channelSet.addChannel&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;channel&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;ro:RemoteObject&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;RemoteObject&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;amfphp&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;ro.channelSet&amp;nbsp;=&amp;nbsp;channelSet;&lt;/font&gt;&lt;br /&gt;&lt;font color="#009900"&gt;//&amp;nbsp;Specify&amp;nbsp;the&amp;nbsp;PHP&amp;nbsp;class&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;ro.source&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;TestService&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;ro.addEventListener&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;FaultEvent.FAULT,&amp;nbsp;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;event:FaultEvent&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;:&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;trace&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;Fault:&amp;nbsp;&amp;#34;&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;+&amp;nbsp;event.fault&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;})&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;ro.addEventListener&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;ResultEvent.RESULT,&amp;nbsp;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;event:ResultEvent&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;:&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;trace&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;Result:&amp;nbsp;&amp;#34;&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;+&amp;nbsp;event.result&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;})&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#009900"&gt;//&amp;nbsp;the&amp;nbsp;TestService&amp;nbsp;class&amp;nbsp;must&amp;nbsp;have&amp;nbsp;a&amp;nbsp;public&amp;nbsp;helloWorld&amp;nbsp;function&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;ro.helloWorld&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;You could also do the same in MXML:&lt;br /&gt;&lt;pre style="background-color: #F0F0DD;"&gt;&lt;font color="#0000ff"&gt;&amp;lt;mx:ChannelSet &lt;/font&gt;&lt;font color="#000000"&gt;id=&lt;/font&gt;&lt;font color="#990000"&gt;"channelSet"&lt;/font&gt;&amp;gt;&lt;br/&gt;    &lt;font color="#0000ff"&gt;&amp;lt;mx:channels&amp;gt;&lt;/font&gt;&lt;br/&gt;        &lt;font color="#0000ff"&gt;&amp;lt;mx:AMFChannel &lt;/font&gt;&lt;font color="#000000"&gt;uri=&lt;/font&gt;&lt;font color="#990000"&gt;"http://localhost/amfphp/gateway.php"&lt;/font&gt;&lt;font color="#0000ff"&gt;/&amp;gt;&lt;/font&gt;&lt;br/&gt;    &lt;font color="#0000ff"&gt;&amp;lt;/mx:channels&amp;gt;&lt;/font&gt;&lt;br/&gt;&lt;font color="#0000ff"&gt;&amp;lt;/mx:ChannelSet&amp;gt;&lt;/font&gt;&lt;br/&gt;&lt;font color="#0000ff"&gt;&amp;lt;mx:RemoteObject &lt;/font&gt;&lt;font color="#000000"&gt;source=&lt;/font&gt;&lt;font color="#990000"&gt;"TestService"&lt;/font&gt; &lt;font color="#000000"&gt;destination=&lt;/font&gt;&lt;font color="#990000"&gt;"amfphp"&lt;/font&gt; &lt;br/&gt;                 &lt;font color="#000000"&gt;channelSet=&lt;/font&gt;&lt;font color="#990000"&gt;"{channelSet}"&lt;/font&gt; &lt;font color="#000000"&gt;id=&lt;/font&gt;&lt;font color="#990000"&gt;"remoteObject"&lt;/font&gt;&lt;br/&gt;                 &lt;font color="#000000"&gt;fault=&lt;/font&gt;&lt;font color="#990000"&gt;"trace('Fault: '+event.fault)"&lt;/font&gt; &lt;br/&gt;                 &lt;font color="#000000"&gt;result=&lt;/font&gt;&lt;font color="#990000"&gt;"trace('Result: '+event.result)"&lt;/font&gt;&lt;font color="#0000ff"&gt;/&amp;gt;&lt;/font&gt;&lt;/pre&gt;&lt;br /&gt;And the corresponding &lt;b&gt;PHP&lt;/b&gt; code (put the php file inside your webroot/amfphp/services directory):&lt;br /&gt;&lt;div align="left" class="code"&gt;&amp;lt;?php&lt;table border="0" cellpadding="3" cellspacing="0"&gt;&lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#9900cc"&gt;&lt;b&gt;class&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;TestService&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;helloWorld&lt;/font&gt;&lt;font color="#000000"&gt;()&amp;nbsp;{&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;return&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;Hello&amp;nbsp;from&amp;nbsp;PHP&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;?&amp;gt;&lt;/div&gt;&lt;br /&gt;So what are the benefits of this approach?  Well, I'm not sure.  In my case it was better because I have one logging class that does all the remoting, and is used by many different Flex applications.  So instead of having to duplicate the services-config.xml file in every flex application this way I could define my endpoint url (http://localhost/amfphp/gateway.php) in one place.  &lt;br /&gt;&lt;br /&gt;Here is another site that is useful when getting started with amfphp:&lt;br /&gt;&lt;li&gt;&lt;a href="http://polygeek.com/amfphp-video-tutorials"&gt;amfphp video tutorials&lt;/a&gt;&lt;/li&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-7114769816698422875?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/7114769816698422875/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=7114769816698422875&amp;isPopup=true' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7114769816698422875'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7114769816698422875'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/05/using-flex-and-amfphp-without-services.html' title='Using Flex and AMFPHP without a services-config.xml file'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-8554033147958628570</id><published>2009-04-29T11:36:00.000-07:00</published><updated>2009-04-29T12:00:49.663-07:00</updated><title type='text'>FlashVars - passing parameters into Flash/Flex</title><content type='html'>I'm sure most people are familiar with how to pass parameters into Flex using &lt;b&gt;FlashVars&lt;/b&gt;.  If you edit your project's &lt;b&gt;html-template/index.template.html&lt;/b&gt; file and add in the flashVars parameter into the JavaScript like this:&lt;br /&gt;&lt;code style="font-weight:normal"&gt;&lt;br /&gt;...&lt;br /&gt;} else if (hasRequestedVersion) {&lt;br /&gt; // if we've detected an acceptable version&lt;br /&gt; // embed the Flash Content SWF when all tests are passed&lt;br /&gt; AC_FL_RunContent(&lt;br /&gt;   "src", "FlashVarsTest",&lt;br /&gt;   "width", "100%",&lt;br /&gt;   "height", "100%",&lt;br /&gt;   "align", "middle",&lt;br /&gt;   "id", "FlashVarsTest",&lt;br /&gt;   "quality", "high",&lt;br /&gt;   "bgcolor", "#ffffff",&lt;br /&gt;   "name", "FlashVarsTest",&lt;br /&gt;   "allowScriptAccess","always",&lt;br /&gt;   "type", "application/x-shockwave-flash",&lt;br /&gt;   &lt;b&gt;"flashVars", "hello=world&amp;another=one",&lt;/b&gt;&lt;br /&gt;   "pluginspage", "http://www.adobe.com/go/getflashplayer"&lt;br /&gt; );&lt;br /&gt;  }...&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;This adds two parameters which can be accessed from inside Flex using the &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/core/Application.html#parameters"&gt;Application.application.parameters&lt;/a&gt; variable.  E.g.  &lt;code&gt;Application.application.parameters.hello&lt;/code&gt; gives you the value "world".&lt;br /&gt;&lt;br /&gt;But if you don't want to use JavaScript (which I wouldn't recommend, but is necessary in a few cases) then you can use the old loading method (also included in the index.template.html file) like this.  The important thing to note is that Internet Explorer loads the parameters in differently than all other browsers (that I've tested).&lt;br /&gt;&lt;code style="font-weight:normal"&gt;&lt;br /&gt;&amp;lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"&lt;br /&gt;   id="FlashVarsTest" width="100%" height="100%"&lt;br /&gt;   codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"&amp;gt;&lt;br /&gt;   &amp;lt;param name="movie" value="FlashVarsTest.swf" /&amp;gt;&lt;br /&gt;   &amp;lt;param name="quality" value="high" /&amp;gt;&lt;br /&gt;   &amp;lt;param name="bgcolor" value="#ffffff" /&amp;gt;&lt;br /&gt;   &lt;b&gt;&amp;lt;param name="flashVars" value="FlashParameters=Internet Explorer only"/&amp;gt;&lt;/b&gt;&lt;br /&gt;   &amp;lt;param name="allowScriptAccess" value="always" /&amp;gt;&lt;br /&gt;   &amp;lt;embed src="FlashVarsTest.swf" quality="high" bgcolor="#ffffff"&lt;br /&gt;    width="100%" height="100%" name="FlashVarsTest" align="middle"&lt;br /&gt;    play="true"&lt;br /&gt;    loop="false"&lt;br /&gt;    allowScriptAccess="always"&lt;br /&gt;    type="application/x-shockwave-flash"&lt;br /&gt;    &lt;b&gt;flashVars="FlashParameters=FireFox,Safari,Chrome"&lt;/b&gt;&lt;br /&gt;    pluginspage="http://www.adobe.com/go/getflashplayer"&amp;gt;&lt;br /&gt;   &amp;lt;/embed&amp;gt;&lt;br /&gt; &amp;lt;/object&amp;gt;&lt;br /&gt;&lt;/code&gt;And the same thing applies to the other tags: &lt;b&gt;bgcolor&lt;/b&gt;, &lt;b&gt;width&lt;/b&gt;, &lt;b&gt;height&lt;/b&gt;.  Internet Explorer reads in the values that are in the &lt;b&gt;&amp;lt;object&amp;gt;&lt;/b&gt; tag, while all other browsers (FireFox, Chrome, Safari, ...) read in the values from inside the &lt;b&gt;&amp;lt;embed&amp;gt;&lt;/b&gt; tag.   So you have to make sure to duplicate all the values.&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-8554033147958628570?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/8554033147958628570/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=8554033147958628570&amp;isPopup=true' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/8554033147958628570'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/8554033147958628570'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/04/flashvars-passing-parameters-into.html' title='FlashVars - passing parameters into Flash/Flex'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-1217085465029882499</id><published>2009-04-24T16:54:00.001-07:00</published><updated>2012-01-27T11:31:05.864-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Lines'/><category scheme='http://www.blogger.com/atom/ns#' term='Tree'/><category scheme='http://www.blogger.com/atom/ns#' term='AdvancedDataGrid'/><title type='text'>Tree Lines</title><content type='html'>In Flex I've seen how you can configure &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/Tree.html" target="_blank"&gt;Trees&lt;/a&gt; by changing the disclosure (expand/collapse) icon, the folder/leaf icons, background colors, indentation, etc.  But I've never seen the option for rendering tree lines like you can in Java, C# and most other languages.  &lt;br /&gt;&lt;br /&gt;I've created a custom &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/treeClasses/TreeItemRenderer.html" target="_blank"&gt;TreeItemRenderer&lt;/a&gt; that does renderer tree lines.  It has these properties:&lt;pre&gt;&lt;font color="#0000ff"&gt;&amp;lt;ui:TreeItemLinesRenderer&lt;/font&gt;&lt;br /&gt;Styles&lt;br /&gt;&lt;font color="#000000"&gt;lineAlpha=&lt;/font&gt;&lt;font color="#990000"&gt;"1"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;lineColor=&lt;/font&gt;&lt;font color="#990000"&gt;"#808080"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;lineThickness=&lt;/font&gt;&lt;font color="#990000"&gt;"1"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;lineStyle=&lt;/font&gt;&lt;font color="#990000"&gt;"dotted"&lt;/font&gt;&lt;font color="#0000ff"&gt;/&amp;gt;&lt;/font&gt;&lt;/pre&gt;And here is an example of it in action (right click to view source):&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/treelines/TreeLinesTest.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="570" height="300"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;If you know of any other solutions out there I'd be interested to see them. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;** September 28th 2009 Updated **&lt;/b&gt;&lt;br /&gt;I've added another example application showing how to render tree lines in an AdvancedDataGrid control.&lt;li&gt;&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/treelines/AdvancedDataGridTreeLinesTest.html" target="_blank" style="color:#990000"&gt;Flex Example Application&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/AdvancedDataGrid.html" target="_blank"&gt;AdvancedDataGrid API&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/advancedDataGridClasses/AdvancedDataGridGroupItemRenderer.html" target="_blank"&gt;AdvancedDataGridGroupItemRenderer API&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;b&gt;&lt;font color="#FF6600"&gt;&lt;u&gt;Flex 4/Spark Version&lt;/u&gt;&lt;/font&gt;&lt;/b&gt;&lt;br /&gt;Here is a very similar version written in Flex 4.  It uses a lot of the same code, but uses a Spark item renderer instead.  There is probably a much nicer way to do this using the new Spark Path or Line controls, but since the code was already written I went with this solution.&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex4/treelines/TreeLinesTest.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="570" height="300"&gt;&lt;/iframe&gt;&lt;br /&gt;An example of &lt;a href="http://flexdevtips.blogspot.com/2010/09/flex-4-tree-lines.html"&gt;tree lines in an AdvancedDataGrid&lt;/a&gt; with a Flex 4 itemRenderer is on my newer blog post.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-1217085465029882499?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/1217085465029882499/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=1217085465029882499&amp;isPopup=true' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/1217085465029882499'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/1217085465029882499'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/04/tree-lines.html' title='Tree Lines'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-6790275935791859638</id><published>2009-04-22T15:19:00.000-07:00</published><updated>2010-01-29T12:19:20.658-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='book'/><title type='text'>AdvancED Flex 3 Book</title><content type='html'>&lt;a href="http://www.friendsofed.com/book.html?isbn=9781430210276" target="_blank"&gt;&lt;img align="right" src="http://www.friendsofed.com/img/cover/9781430210276.jpg" border="0"/&gt;&lt;/a&gt;&lt;br /&gt;Does anyone own this book?   It covers some good material but the code samples in it are terrible!  I've never seen so many typos and so much code that does not even compile.&lt;br /&gt;&lt;br /&gt;Here's my favorite code example from the book, see if you can count how many different compile errors and warnings you get from this snippet (page 172 of the book, copyright 2008, ...):&lt;div align="left" class="code" style="width: 400px"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;&lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;myVariable:String;&lt;/font&gt;&lt;br /&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;public&amp;nbsp;get&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;myVariable&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;:&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;return&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;myVariable;&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;[&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;Bindable&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;]&lt;/font&gt;&lt;br /&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;public&amp;nbsp;set&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;myVariable&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;value:String&lt;/font&gt;&lt;font color="#000000"&gt;)&amp;nbsp;{&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;myVariable&amp;nbsp;=&amp;nbsp;value;&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;It seems like after almost every page I read in it I have to type the code into Flex Builder to verify that in fact no, you can't do it that way because it doesn't even compile. &lt;br /&gt;&lt;br /&gt;Anyways, hopefully not too many people buy this book...   Or maybe by the next edition they will have fixed up the many errors.&lt;br /&gt;&lt;br /&gt;Another Flex/ActionScript book that I bought and think quite highly of is this one:&lt;br /&gt;&lt;iframe src="http://rcm.amazon.com/e/cm?t=fle07-20&amp;o=1&amp;p=8&amp;l=bpl&amp;asins=0470135603&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;m=amazon&amp;lc1=0000FF&amp;bc1=000000&amp;bg1=FFFFFF&amp;f=ifr" style="align:left;padding-top:5px;width:131px;height:245px;padding-right:10px;" align="left" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;/br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-6790275935791859638?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/6790275935791859638/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=6790275935791859638&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/6790275935791859638'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/6790275935791859638'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/04/advanced-flex-3-book.html' title='AdvancED Flex 3 Book'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-1902878651900003290</id><published>2009-04-21T10:33:00.000-07:00</published><updated>2009-05-28T10:57:58.524-07:00</updated><title type='text'>Number and NaN</title><content type='html'>What is the output of the following code?&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;n1:Number&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;n2:Number;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;trace&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;n1&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;trace&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;n2&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;I have Java background, so the whole &lt;code&gt;NaN&lt;/code&gt; concept still confuses me sometimes.  I would have expected that assigning &lt;code&gt;null&lt;/code&gt; to a &lt;code&gt;Number&lt;/code&gt; would be the same as not assigning anything to the Number.  But no!  When you assign &lt;code&gt;n1&lt;/code&gt; to null, it actually is the same as assigning it the value &lt;b&gt;0&lt;/b&gt;!  Although the Flex compiler will actually give you a warning if you try this.  If you leave a Number unassigned like &lt;code&gt;n2&lt;/code&gt;, then it has the value &lt;code&gt;NaN&lt;/code&gt;.  Or if you try to cast a String or Object into a Number and it fails then the Number will also be &lt;code&gt;NaN&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;And one last note - don't set the &lt;code&gt;horizontalGap&lt;/code&gt; or &lt;code&gt;verticalGap&lt;/code&gt; (or any other style used by layouts) to &lt;code&gt;NaN&lt;/code&gt; otherwise the &lt;code&gt;BoxLayout&lt;/code&gt; will not work at all.  Took me a while to figure out why my &lt;code&gt;VBox&lt;/code&gt; wasn't laying out all the components properly!&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-1902878651900003290?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/1902878651900003290/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=1902878651900003290&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/1902878651900003290'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/1902878651900003290'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/04/number-and-nan.html' title='Number and NaN'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-3434045815600898431</id><published>2009-04-16T16:11:00.000-07:00</published><updated>2012-01-27T11:26:53.412-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tree'/><category scheme='http://www.blogger.com/atom/ns#' term='Spinner'/><category scheme='http://www.blogger.com/atom/ns#' term='Icon'/><category scheme='http://www.blogger.com/atom/ns#' term='AdvancedDataGrid'/><title type='text'>Tree Icon Spinner (not using animated gif)</title><content type='html'>I've been disappointed that Flex doesn't natively support animated gifs.  I especially wanted to use them inside Flex &lt;code&gt;Trees&lt;/code&gt; when I'm loading the children dynamically.  So instead of trying to get animated gifs to work (see this &lt;a href="http://stackoverflow.com/questions/152129/animated-gifs-in-flex-3" target="_blank"&gt;example&lt;/a&gt; if you are interested) I created a relatively simple &lt;code&gt;Spinner&lt;/code&gt; class that draws a circular spinner using just Flex &lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/display/Graphics.html"&gt;Graphics&lt;/a&gt;. The spinner is animated using a &lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/utils/Timer.html"&gt;Timer&lt;/a&gt;. If you set the &lt;b&gt;startImmediately&lt;/b&gt; property to true then the animation starts when the spinner component is added to a parent component. And it is always stopped when it gets removed from its parent.  &lt;br /&gt;There are also the &lt;b&gt;start()&lt;/b&gt;, &lt;b&gt;stop()&lt;/b&gt; and &lt;b&gt;running&lt;/b&gt; functions to control the spinner manually.&lt;br /&gt;&lt;br /&gt;The spinners have a few styles that you can set to customize the appearance:&lt;pre&gt;&lt;font color="#0000ff"&gt;&amp;lt;ui:Spinner&lt;br /&gt;&lt;/font&gt;  Properties&lt;br /&gt;&lt;font color="#000000"&gt;delay=&lt;/font&gt;&lt;font color="#990000"&gt;"100"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;startImmediately=&lt;/font&gt;&lt;font color="#990000"&gt;"false"&lt;/font&gt;&lt;br /&gt;Styles&lt;br /&gt;&lt;font color="#000000"&gt;backgroundAlpha=&lt;/font&gt;&lt;font color="#990000"&gt;"1"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;backgroundColor=&lt;/font&gt;&lt;font color="#990000"&gt;"NaN"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;spinnerColor=&lt;/font&gt;&lt;font color="#990000"&gt;"#829AD1"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;spinnerHighlightColor=&lt;/font&gt;&lt;font color="#990000"&gt;"#001A8E"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;spinnerThickness=&lt;/font&gt;&lt;font color="#990000"&gt;"3"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;spinnerLineThickness=&lt;/font&gt;&lt;font color="#990000"&gt;"2"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;spinnerType=&lt;/font&gt;&lt;font color="#990000"&gt;"gradientcircle"&lt;/font&gt;&lt;font color="#0000ff"&gt;/&amp;gt;&lt;/font&gt;&lt;/pre&gt;&lt;br /&gt;I've created an example of the four types of spinners in four &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/Tree.html"&gt;Trees&lt;/a&gt;.  Each tree node loads its children after a 2 second delay during which time the spinner is shown, so try expanding each tree (right click to view source):&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/spinner/SpinnerTest.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="650" height="300"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;Let me know if you like them!&lt;br /&gt;&lt;br /&gt;Also, make sure you do call stop() on the spinner when you don't need it anymore... otherwise you might notice your Flex app starts to run very slowly like mine did...&lt;br /&gt;&lt;br /&gt;&lt;b&gt;** September 28th 2009 Updated **&lt;/b&gt;&lt;br /&gt;I've added another example application showing how to show the spinner inside an AdvancedDataGrid control.&lt;br /&gt;&lt;li&gt;&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/spinner/ADGSpinnerTest.html" target="_blank" style="color:#990000"&gt;Flex Example Application&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/AdvancedDataGrid.html" target="_blank"&gt;AdvancedDataGrid API&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/advancedDataGridClasses/AdvancedDataGridGroupItemRenderer.html" target="_blank"&gt;AdvancedDataGridGroupItemRenderer API&lt;/a&gt;&lt;/li&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-3434045815600898431?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/3434045815600898431/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=3434045815600898431&amp;isPopup=true' title='19 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/3434045815600898431'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/3434045815600898431'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/04/tree-icon-spinner-not-using-animated.html' title='Tree Icon Spinner (not using animated gif)'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>19</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-6144886540966874816</id><published>2009-04-01T16:42:00.000-07:00</published><updated>2012-01-27T11:24:42.820-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='title border'/><title type='text'>Titled Border Box and Titled Border Panel</title><content type='html'>&lt;b&gt;** There is a Flex 4/Spark version of this control which can be found &lt;a href="http://flexdevtips.blogspot.com/2010/06/titledborderbox-flex-4spark.html"&gt;here&lt;/a&gt;.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;I've written two new components called &lt;code&gt;TitledBorderBox&lt;/code&gt; and &lt;code&gt;TitledBorderWindow&lt;/code&gt; that both render a solid border around the component with a title textfield at the top.  They are similar to &lt;b&gt;TitledBorder&lt;/b&gt; in Java, and the &lt;b&gt;&amp;lt;Fieldset&amp;gt;&lt;/b&gt; tag in HTML.  &lt;br /&gt;&lt;br /&gt;Skip straight to the examples - here are three &lt;code&gt;TitledBorderBox&lt;/code&gt; components that illustrate the three layouts (vertical, horizontal, and absolute) and various title styles (right-click to View Source):&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/titledborder/TitledBorderTest.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="540" height="150"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;And here is an example of the &lt;code&gt;TitledBorderWindow&lt;/code&gt; that illustrate how the border and background changes with the various properties (right-click to View Source):&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/titledborder/TitledWindowTest.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="540" height="310"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;Here are the properties and styles:&lt;pre&gt;&lt;font color="#0000ff"&gt;&amp;lt;ui:TitledBorderBox&lt;br /&gt;&lt;/font&gt;  Properties&lt;br /&gt;&lt;font color="#000000"&gt;layout=&lt;/font&gt;&lt;font color="#990000"&gt;"vertical|horizontal|absolute"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;title=&lt;/font&gt;&lt;font color="#990000"&gt;""&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;borderDropShadow=&lt;/font&gt;&lt;font color="#990000"&gt;"false"&lt;/font&gt;&lt;br /&gt;Styles&lt;br /&gt;&lt;font color="#000000"&gt;backgroundAlpha=&lt;/font&gt;&lt;font color="#990000"&gt;"0"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;backgroundColor=&lt;/font&gt;&lt;font color="#990000"&gt;"0xffffff"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;borderAlpha=&lt;/font&gt;&lt;font color="#990000"&gt;"1"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;borderColor=&lt;/font&gt;&lt;font color="#990000"&gt;"#000000"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;borderThickness=&lt;/font&gt;&lt;font color="#990000"&gt;"1"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;cornerRadius=&lt;/font&gt;&lt;font color="#990000"&gt;"0"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;horizontalGap=&lt;/font&gt;&lt;font color="#990000"&gt;"8"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;paddingLeft=&lt;/font&gt;&lt;font color="#990000"&gt;"5"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;paddingTop=&lt;/font&gt;&lt;font color="#990000"&gt;"5"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;paddingRight=&lt;/font&gt;&lt;font color="#990000"&gt;"5"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;paddingTop=&lt;/font&gt;&lt;font color="#990000"&gt;"5"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;verticalGap=&lt;/font&gt;&lt;font color="#990000"&gt;"6"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;titleStyleName=&lt;/font&gt;&lt;font color="#990000"&gt;"windowStyles"&lt;/font&gt;&lt;font color="#0000ff"&gt;/&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#0000ff"&gt;&amp;lt;ui:TitledBorderWindow&lt;br /&gt;&lt;/font&gt;  Properties&lt;br /&gt;&lt;font color="#000000"&gt;layout=&lt;/font&gt;&lt;font color="#990000"&gt;"vertical|horizontal|absolute"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;title=&lt;/font&gt;&lt;font color="#990000"&gt;""&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;borderDropShadow=&lt;/font&gt;&lt;font color="#990000"&gt;"false"&lt;/font&gt;&lt;br /&gt;Styles&lt;br /&gt;&lt;font color="#000000"&gt;backgroundAlpha=&lt;/font&gt;&lt;font color="#990000"&gt;"0"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;backgroundColor=&lt;/font&gt;&lt;font color="#990000"&gt;"0xffffff"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;borderColor=&lt;/font&gt;&lt;font color="#990000"&gt;"#000000"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;borderThickness=&lt;/font&gt;&lt;font color="#990000"&gt;"1"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;borderAlpha=&lt;/font&gt;&lt;font color="#990000"&gt;"1"&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;cornerRadius=&lt;/font&gt;&lt;font color="#990000"&gt;"0"&lt;/font&gt;&lt;font color="#0000ff"&gt;/&amp;gt;&lt;/font&gt;&lt;/pre&gt;Set the &lt;code&gt;cornerRadius&lt;/code&gt; style to have rounded corners.  The TitledBorderWindow also supports the &lt;code&gt;roundedBottomCorners&lt;/code&gt; boolean style too if you only want rounded corners at the top.  And both components can have an optional drop shadow filter as well.  &lt;br /&gt;&lt;br /&gt;The &lt;code&gt;TitledBorderWindow&lt;/code&gt; extends &lt;code&gt;TitleWindow&lt;/code&gt; (which extends &lt;code&gt;Panel&lt;/code&gt;) so it has all the same properties and styles.  The styles that have changed from the Panel/TitleWindow defaults are listed above.  I've also added support for adding custom buttons to the titleBar (next to the closeButton).&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Update (April 14th 2009)&lt;/b&gt;: The &lt;code&gt;TitledBorderWindow&lt;/code&gt; class wasn't properly laying out the &lt;code&gt;ControlBar&lt;/code&gt; like the &lt;code&gt;Panel&lt;/code&gt; class does, so I've added a fix for it.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Update (March 17th 2010)&lt;/b&gt;: scrollbars weren't correctly on the &lt;b&gt;TitleBorderBox&lt;/b&gt; class when you use either the horizontal or vertical layout (and you restrict the size of the box).  I've fixed up the &lt;b&gt;borderMetrics&lt;/b&gt; function to property return the size of the border and now the scrollbars work properly.  I also noticed that the background color didn't work if you set the layout to absolute, and that is fixed too.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Update (June 1st, 2010)&lt;/b&gt;: I've made a Flex 4/Spark version which can be found &lt;a href="http://flexdevtips.blogspot.com/2010/06/titledborderbox-flex-4spark.html"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/br&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-6144886540966874816?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/6144886540966874816/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=6144886540966874816&amp;isPopup=true' title='17 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/6144886540966874816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/6144886540966874816'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/04/titled-border-box.html' title='Titled Border Box and Titled Border Panel'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>17</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-6177243631841468263</id><published>2009-03-31T12:27:00.000-07:00</published><updated>2012-01-27T11:22:57.805-08:00</updated><title type='text'>Showing the preloader again after loading is finished</title><content type='html'>This is probably not very important for most people, but when I was designing my custom preloader I found it quite difficult to get it looking exactly right - the positioning, font sizes, image location, etc.  And so I was constantly reloading to see the preloader appear again.&lt;br /&gt;&lt;br /&gt;So I wrote this simple test to show the preloader again after the application has loaded.  This way you can control how long the preloader is visible for, and you don't have to add all these large images to make it slow to load.&lt;br /&gt;&lt;br /&gt;** Here is the link to my previous blog post on &lt;a href="http://flexdevtips.blogspot.com/2009/03/another-custom-preloader.html"&gt;Custom preloaders&lt;/a&gt;.  It also contains some useful links to other websites and tutorials on custom preloaders.&lt;br /&gt;&lt;br /&gt;Right Click to View Source:&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/preloader/PreloaderTest.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="720" height="420"&gt;&lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-6177243631841468263?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/6177243631841468263/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=6177243631841468263&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/6177243631841468263'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/6177243631841468263'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/03/showing-preloader-again-after-loading.html' title='Showing the preloader again after loading is finished'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-335056300259048461</id><published>2009-03-23T17:08:00.000-07:00</published><updated>2012-01-27T11:21:34.752-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='class construct'/><category scheme='http://www.blogger.com/atom/ns#' term='default styles'/><category scheme='http://www.blogger.com/atom/ns#' term='custom components'/><title type='text'>Setting default styles for custom components</title><content type='html'>When creating custom components (e.g. extending &lt;code&gt;Canvas&lt;/code&gt;) we sometimes want to define new style properties on our components.  When I first started with Flex I would always call the &lt;code&gt;setStyle()&lt;/code&gt; function from the constructor of my custom component.  Then I noticed that if I tried to set my style property from inside MXML it didn't work.  &lt;br /&gt;&lt;br /&gt;So far I've come across two ways of solving this problem.&lt;ol&gt;&lt;li&gt;&lt;a href="http://flexdevtips.blogspot.com/2009/06/default-stylesheet-in-swc-flex-library.html"&gt;Default Style Sheet - defaults.css (blog post)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Class Construct&lt;/li&gt;&lt;/ol&gt;This blog post talks about the &lt;b&gt;class construct&lt;/b&gt; idea:&lt;br /&gt;&lt;u&gt;&lt;b&gt;Flex 3&lt;/b&gt;&lt;/u&gt;:&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;&lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;private&amp;nbsp;static&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;classConstructed:Boolean&amp;nbsp;=&amp;nbsp;classConstruct&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;private&amp;nbsp;static&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;classConstruct&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;:Boolean&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;if&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;!StyleManager.getStyleDeclaration&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;StyledRectangle&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;))&amp;nbsp;{&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;no&amp;nbsp;CSS&amp;nbsp;definition&amp;nbsp;for&amp;nbsp;StyledRectangle,&amp;nbsp;so&amp;nbsp;create&amp;nbsp;and&amp;nbsp;set&amp;nbsp;default&amp;nbsp;values&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;myRectStyles:CSSStyleDeclaration&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;CSSStyleDeclaration&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;myRectStyles.defaultFactory&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;:&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;this&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;.fillColors&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;[&lt;/font&gt;&lt;font color="#000000"&gt;0xFF0000&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;0x0000FF&lt;/font&gt;&lt;font color="#000000"&gt;]&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;this&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;.alphas&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;[&lt;/font&gt;&lt;font color="#000000"&gt;0.5&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;0.5&lt;/font&gt;&lt;font color="#000000"&gt;]&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;StyleManager.setStyleDeclaration&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;StyledRectangle&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;myRectStyles,&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;true&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;return&amp;nbsp;true&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;u&gt;&lt;b&gt;Flex 4&lt;/b&gt;&lt;/u&gt;:&lt;br /&gt;&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;&lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;private&amp;nbsp;static&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;classConstructed:Boolean&amp;nbsp;=&amp;nbsp;classConstruct&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;private&amp;nbsp;static&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;classConstruct&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;:Boolean&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;if&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;!FlexGlobals.topLevelApplication.styleManager.&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;getStyleDeclaration&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;myComponents.StyledRectangle&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;))&amp;nbsp;{&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;No&amp;nbsp;CSS&amp;nbsp;definition&amp;nbsp;for&amp;nbsp;StyledRectangle,&amp;nbsp;&amp;nbsp;so&amp;nbsp;create&amp;nbsp;and&amp;nbsp;set&amp;nbsp;default&amp;nbsp;values&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;myRectStyles:CSSStyleDeclaration&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;CSSStyleDeclaration&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;myRectStyles.defaultFactory&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;:&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;this&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;.fillColors&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;[&lt;/font&gt;&lt;font color="#000000"&gt;0xFF0000&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;0x0000FF&lt;/font&gt;&lt;font color="#000000"&gt;]&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;this&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;.alphas&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;[&lt;/font&gt;&lt;font color="#000000"&gt;0.5&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;0.5&lt;/font&gt;&lt;font color="#000000"&gt;]&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;FlexGlobals.topLevelApplication.styleManager.&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;setStyleDeclaration&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;myComponents.StyledRectangle&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;myRectStyles,&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;true&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;return&amp;nbsp;true&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;font color="#aa0000"&gt;&lt;b&gt;&lt;u&gt;** Very important&lt;/u&gt;&lt;/b&gt;&lt;/font&gt; - in Flex4 you set the fully qualified class name (including package) in the style manager, this is different from Flex 3.  It won't work if you only set it to the class name "StyledRectangle".&lt;br /&gt;&lt;br /&gt;For a while that satisfied my needs, but then I recently came across a problem with the above code (which by the way was copied from the &lt;a href="http://livedocs.adobe.com/flex/3/html/help.html?content=skinstyle_3.html" target="_blank"&gt;Adobe LiveDocs&lt;/a&gt;).  If you scroll to the bottom you'll actually notice that someone else posted this same problem that I'm about to mention.&lt;br /&gt;&lt;br /&gt;If you specify some styles using a StyleSheet, then the above code no longer works because no the &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/styles/StyleManager.html#getStyleDeclaration()" target="CSSStyleDeclaration"&gt;StyleManager.getStyleDeclaration("StyledRectangle")&lt;/a&gt; doesn't return null, and so the default styles aren't set unless you specifically set them in your stylesheet.&lt;br /&gt;&lt;br /&gt;To illustrate this problem I've gone overboard and created 5 examples to show you the evolution of my learning (Source code is available for all examples, just right click View Source.  You can also click on the mxml link for each to jump directly to the mxml html view).&lt;br /&gt;&lt;!-- remove the extra line breaks! --&gt;&lt;br /&gt;&lt;style type="text/css"&gt;.nobrtable br { display: none } br.ok { display: block; }&lt;/style&gt;&lt;div class="nobrtable"&gt;&lt;br /&gt;&lt;br /&gt;&lt;table cellpadding="4" cellspacing="0" border="1" style="padding: 0;margin:0"&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;Example #1 (&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/customcomponentstyles/srcview/source/CustomComponents1.mxml.html" target="CustomComponents"&gt;CustomComponents1.mxml&lt;/a&gt;)&lt;/b&gt;&lt;br class="ok"&gt;I created a simple extension of the &lt;code&gt;Canvas&lt;/code&gt; class which is called &lt;code&gt;GradientCanvas1&lt;/code&gt; that draws the background as a gradient using the colors and alpha values defined in the two styles&lt;/td&gt;&lt;td&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/customcomponentstyles/CustomComponents1.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="100" height="100"&gt;&lt;/iframe&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;Example #1B (&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/customcomponentstyles/srcview/source/CustomComponents1B.mxml.html" target="CustomComponents"&gt;CustomComponents1B.mxml&lt;/a&gt;)&lt;/b&gt;&lt;br class="ok"&gt;The problem with the &lt;code&gt;GradientCanvas1&lt;/code&gt; class is that it ignores the style values that I specify in the MXML, e.g. &lt;code&gt;fillColors="[0xff0000,0x0000ff]"&lt;/code&gt;.&lt;/td&gt;&lt;td&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/customcomponentstyles/CustomComponents1B.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="100" height="100"&gt;&lt;/iframe&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;Example #2 (&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/customcomponentstyles/srcview/source/CustomComponents2.mxml.html" target="CustomComponents"&gt;CustomComponents2.mxml&lt;/a&gt;)&lt;/b&gt;&lt;br class="ok"&gt;To solve the problem mentioned in Example #1B I've created another class called (creatively) &lt;code&gt;GradientCanvas2&lt;/code&gt; that uses the class construct idea mentioned at the top of this blog entry. This static class construct sets up the default style values and now setting style properties in MXML works.&lt;/td&gt;&lt;td&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/customcomponentstyles/CustomComponents2.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="100" height="100"&gt;&lt;/iframe&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;Example #2B (&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/customcomponentstyles/srcview/source/CustomComponents2B.mxml.html" target="CustomComponents"&gt;CustomComponents2B.mxml&lt;/a&gt;)&lt;/b&gt;&lt;br class="ok"&gt;The problem with the &lt;code&gt;GradientCanvas2&lt;/code&gt; class is that if you use a stylesheet to define some (but not all) of the styles on the &lt;code&gt;GradientCanvas2&lt;/code&gt; class then the class construct no longer works because the &lt;code&gt;StyleManager.getStyleDeclaration("GradientCanvas2")&lt;/code&gt; doesn't return null anymore, and so our default styles aren't used.&lt;/td&gt;&lt;td&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/customcomponentstyles/CustomComponents2B.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="100" height="100"&gt;&lt;/iframe&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;Example #3 (&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/customcomponentstyles/srcview/source/CustomComponents3.mxml.html" target="CustomComponents"&gt;CustomComponents3.mxml&lt;/a&gt;)&lt;/b&gt;&lt;br class="ok"&gt;And finally, the solution that I'm using (might still be problems with it).  In the class &lt;code&gt;GradientCanvas3&lt;/code&gt; the class construct now creates a new &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/styles/CSSStyleDeclaration.html" target="CSSStyleDeclaration"&gt;CSSStyleDeclaration&lt;/a&gt; for the class if it is null, and then defines the default styles on the &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/styles/CSSStyleDeclaration.html#defaultFactory" target="CSSStyleDeclaration"&gt;defaultFactory&lt;/a&gt;, and that is it (the livedocs say something about the defaultFactory will only be defined if styles are set in MXML components, but I haven't been able to find a case where the defaultFactory wasn't null).&lt;/td&gt;&lt;td&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/customcomponentstyles/CustomComponents3.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="100" height="100"&gt;&lt;/iframe&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;If anyone has different opinions about this stuff please let me know.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-335056300259048461?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/335056300259048461/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=335056300259048461&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/335056300259048461'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/335056300259048461'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/03/setting-default-styles-for-custom.html' title='Setting default styles for custom components'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-8231789146808279099</id><published>2009-03-19T14:05:00.000-07:00</published><updated>2012-01-27T11:18:05.508-08:00</updated><title type='text'>Another Custom Preloader</title><content type='html'>I've been playing around with preloaders a bit recently, and thought I'd share my custom preloader.  I originally found this very useful article:&lt;br /&gt;&lt;a href="http://www.pathf.com/blogs/2008/08/custom-flex-3-lightweight-preloader-with-source-code/" target="_blank"&gt;http://www.pathf.com/blogs/2008/08/custom-flex-3-lightweight-preloader-with-source-code/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;My &lt;code&gt;CustomPreloader&lt;/code&gt; class is copied from the example above, and modified to be more easily customizable (I hope!).  The colors and sizes are mostly defined at the top of the class.&lt;br /&gt;&lt;br /&gt;The important functions inside &lt;code&gt;CustomPreloader&lt;/code&gt; are as follows (they are all near the top of the class):&lt;li&gt;&lt;code&gt;clear()&lt;/code&gt; - draws the background color/gradient&lt;/li&gt;&lt;li&gt;&lt;code&gt;createAssets()&lt;/code&gt; - creates the assets (logo, progress bar, loading textfield) and positions them on the stage&lt;/li&gt;&lt;li&gt;&lt;code&gt;draw()&lt;/code&gt; - draws the progress bar as the application is loading&lt;/li&gt;&lt;br /&gt;Here is a screenshot of the preloader, click on the image to view the flex application in a new window:&lt;br /&gt;&lt;center&gt;&lt;br /&gt;&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/preloader/Preloader.html" target="_blank"&gt;&lt;img src="http://chris.firlingcanada.com/flexdevtips/flex3/preloader/screenshot.png" border="0" alt="CustomPreloader"&gt;&lt;/a&gt;&lt;br /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;** I've subsequently written a test application which is very useful when designing your custom preloader, check it out here: &lt;a href="http://flexdevtips.blogspot.com/2009/03/showing-preloader-again-after-loading.html"&gt;Showing the preloader again after loading&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Quick links&lt;/b&gt;:&lt;li&gt;&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/preloader/srcview/source/preloader/CustomPreloader.as.html" target="_blank"&gt;CustomPreloader (View Source HTML)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/preloader/CustomPreloader.as" target="_blank"&gt;CustomPreloader.as (direct download)&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;b&gt;More Custom Preloaders and Tutorials&lt;/b&gt;&lt;li&gt;&lt;a href="http://blog.wisebisoft.com/2009/02/05/custom-flex-3-application-preloader/"&gt;Wisebisoft Custom Flex 3 Preloader&lt;/a&gt; (&lt;a href="http://blog.wisebisoft.com/wp-content/uploads/CustomFlexPreloader/CustomFlexPreloader.html"&gt;Example&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.prettyloaded.com/"&gt;A Preloader Museum&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://jessewarden.com/2007/07/making-a-cooler-preloader-in-flex-part-1-of-3.html"&gt;JesseWarden: Making A Cooler Flex Preloader&lt;/a&gt; (&lt;a href="http://www.jessewarden.com/archives/flex/preloader/"&gt;Example&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;&lt;a href="http://npacemo.com/wordpress/2008/07/06/flex-application-bootstrapping-totally-custom-preloader/"&gt;Totally Custom Preloader&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.ajaxload.info/"&gt;Cool Loading Animated Gifs&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://onflash.org/ted/2006/07/flex-2-preloaders-swf-png-gif-examples.php"&gt;Ted On Flash: Flex 2 Preloaders&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-8231789146808279099?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/8231789146808279099/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=8231789146808279099&amp;isPopup=true' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/8231789146808279099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/8231789146808279099'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/03/another-custom-preloader.html' title='Another Custom Preloader'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-4943180551095600962</id><published>2009-03-18T14:14:00.000-07:00</published><updated>2012-01-27T11:15:02.854-08:00</updated><title type='text'>Flex Converter: Currency, Weight, Temperature...</title><content type='html'>I've written a little Flex app that handles converting between a variety of formats:&lt;br /&gt;&lt;li&gt;Currency (using the &lt;a href="http://www.webservicex.net/WCF/ServiceDetails.aspx?SID=18" target="_blank"&gt;www.webservicex.net&lt;/a&gt; Currency Convertor service)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Weight (Pounds/KG)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Distance (Kilometers/Miles)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Temperature (°C/°F)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Pace (minutes per km/mile)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Baking measurements (tablespoons, teaspoons, cups, ml)&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;The currency conversion can be quite slow because it is using the free web service mentioned above.  All the other conversions are simply mathematical.&lt;br /&gt;&lt;br /&gt;See the example below (right click to view source):&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/converter/Converter.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="700" height="250"&gt;&lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-4943180551095600962?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/4943180551095600962/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=4943180551095600962&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/4943180551095600962'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/4943180551095600962'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/03/flex-converter-currency-weight.html' title='Flex Converter: Currency, Weight, Temperature...'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-7826849073224877444</id><published>2009-03-17T17:10:00.000-07:00</published><updated>2012-01-27T11:12:38.585-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='containers'/><category scheme='http://www.blogger.com/atom/ns#' term='cursors'/><category scheme='http://www.blogger.com/atom/ns#' term='resize'/><category scheme='http://www.blogger.com/atom/ns#' term='resizable'/><category scheme='http://www.blogger.com/atom/ns#' term='window'/><title type='text'>Resizable Containers (Flex 3)</title><content type='html'>Please go here for &lt;a href="http://flexdevtips.blogspot.com/2010/06/flex-4-spark-resizable-controls.html"&gt;Flex 4 Spark Resizable Controls&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I previous posted a blog on a &lt;a href="http://flexdevtips.blogspot.com/2008/12/resizable-window.html"&gt;Resizable Movable Panel&lt;/a&gt; control which was an extension of the &lt;code&gt;TitleWindow&lt;/code&gt; class which let the user drag the panel titlebar to move it around the screen, and drag a small resize handle in the bottom right corner to resize the panel.&lt;br /&gt;&lt;br /&gt;I've made some updates to this class, and further extended it to support not just &lt;code&gt;Panel&lt;/code&gt;/&lt;code&gt;TitleWindow&lt;/code&gt; containers, but also &lt;code&gt;Box&lt;/code&gt; (&lt;code&gt;VBox&lt;/code&gt;/&lt;code&gt;HBox&lt;/code&gt;), &lt;code&gt;Canvas&lt;/code&gt;, and &lt;code&gt;TextArea&lt;/code&gt; (similar to what Google Chrome does).&lt;br /&gt;&lt;br /&gt;The main class that does all the work is called &lt;code&gt;ResizeManager&lt;/code&gt;.  It adds a small resize component in the bottom right corner of the container that when dragged resizes the container.  &lt;br /&gt;&lt;br /&gt;Here is an example (right click to view source).  Let me know what you think!&lt;br /&gt;&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/resizecontainers/ResizeContainers.html?v=1.4.4" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="600" height="500"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;Important&lt;/u&gt;&lt;/b&gt;: the resize containers do not resize properly if you set the &lt;code&gt;resizeEffect&lt;/code&gt; property.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;font color="#660000"&gt;For a similar project that is devoted to movable windows, check out the &lt;a href="http://code.google.com/p/flexmdi/"&gt;MDI&lt;/a&gt; project which is now part of the &lt;a href="http://code.google.com/p/flexlib/"&gt;FlexLib&lt;/a&gt; project&lt;/font&gt;&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;font color="#000066"&gt;November 30th 2009 Update&lt;/font&gt;&lt;/b&gt;: I've updated the &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/resizecontainers/srcview/source/flex/utils/ui/resize/MoveManager.as.html"&gt;MoveManager&lt;/a&gt; adding two new fields. Setting the &lt;b&gt;MoveManager.constrainToParentBounds&lt;/b&gt; to true will cause the component's movement to be restricted to the parent's bounds.  You can also set your own custom bound's constraint by setting the &lt;b&gt;constrainToBounds&lt;/b&gt; property to a Rectangle.  The way this works is by passing that bounding Rectangle into the move component's &lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/display/Sprite.html#startDrag()" target="_blank"&gt;startDrag(false, bounds)&lt;/a&gt; function.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;font color="#000066"&gt;December 23rd 2009 Update&lt;/font&gt;&lt;/b&gt;: I've updated the MoveManager and ResizeWindow classes to fix a problem that occurred when movable="true" and resizable="true" and no dragComponent was set.  Now the move and resize should work properly.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;font color="#000066"&gt;January 5th 2010 Update&lt;/font&gt;&lt;/b&gt;: &lt;img style="float: right;margin: 2px" src="http://chris.firlingcanada.com/flexdevtips/flex3/resizecontainers/assets/cursor_move.gif" /&gt;&lt;img style="float: right;margin: 2px" src="http://chris.firlingcanada.com/flexdevtips/flex3/resizecontainers/assets/cursor_resize.gif"/&gt; I've updated the &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/resizecontainers/srcview/source/flex/utils/ui/resize/MoveManager.as.html"&gt;MoveManager&lt;/a&gt;and &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/resizecontainers/srcview/source/flex/utils/ui/resize/ResizeManager.as.html"&gt;ResizeManager&lt;/a&gt;classes to use custom cursors for moving and resizing. You can also set the &lt;b&gt;MoveManager.moveIcon&lt;/b&gt; and &lt;b&gt;ResizeManager.resizeIcon&lt;/b&gt; properties to use your own custom icons, or just edit those classes directly and change the &lt;b&gt;[Embed(source="...")]&lt;/b&gt; metadata tags.&lt;br /&gt;The move cursor is only shown when the mouse is down.  The resize cursor is shown when the mouse is over the resize handle and when the resize is happening.  There might be some problems with the resize cursor getting stuck always on, but hopefully it's a good starting point.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;font color="#000066"&gt;March 4th 2010 Update&lt;/font&gt;&lt;/b&gt;: I've separated the move/drag and resize handles into separate stand-alone components: &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/resizecontainers/srcview/source/flex/utils/ui/resize/DragHandle.as.html"&gt;DragHandle&lt;/a&gt; and &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/resizecontainers/srcview/source/flex/utils/ui/resize/ResizeHandle.as.html"&gt;ResizeHandle&lt;/a&gt;.  The colors of the handles can be customized using styles.  You can also control how many rows and columns of dots are shown in the handles.  Alternatively you can explicitly set a width and height for the drag/resize handles and the number of dots will be calculated automatically to fill the space.  The size of the dots is configurable too.&lt;br /&gt;&lt;br /&gt;I also added a new properties to the resize components - &lt;b&gt;bringToFrontOnResize&lt;/b&gt;, and &lt;b&gt;bringToFrontOnMove&lt;/b&gt; (ResizableWindow only).  These properties determine whether the components should be brought to the front to be on top of the other siblings.  By default these properties are false.  It only makes sense to set these values to true if the parent container is using an absolute layout.&lt;br /&gt;&lt;br /&gt;I've put up a blog post about the &lt;a href="http://flexdevtips.blogspot.com/2010/03/draghandle-resizehandle.html"&gt;DragHandle and ResizeHandle&lt;/a&gt; if you're interested.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;font color="#000066"&gt;September 15th 2010 Update&lt;/font&gt;&lt;/b&gt;: I added a new component - &lt;a href="http://chris.firlingcanada.com/flexdevtips/flex3/resizecontainers/srcview/source/flex/utils/ui/resize/ResizableButton.as.html" target="_blank"&gt;ResizableButton&lt;/a&gt;.  There were a few things that had to be changed to make it resizable and movable since it is not a Container.  The main difference is that the Button class by default has the &lt;b&gt;mouseChildren&lt;/b&gt; property set to false, which prevents the move and resize handles from getting mouse events.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-7826849073224877444?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/7826849073224877444/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=7826849073224877444&amp;isPopup=true' title='110 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7826849073224877444'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7826849073224877444'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/03/resizable-containers.html' title='Resizable Containers (Flex 3)'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>110</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-6434817570235669123</id><published>2009-03-11T10:39:00.000-07:00</published><updated>2009-03-11T10:48:32.495-07:00</updated><title type='text'>VPN Blocking port 80 (not Flex related)</title><content type='html'>This post has nothing to do with Flex, but caused me to waste many hours yesterday so I thought I'd post it in case it helps someone else.&lt;br /&gt;&lt;br /&gt;I recently uninstalled Cisco VPN (on my Windows XP machine), and after rebooting I could no longer use port 80.  At first I thought I couldn't access the internet at all.  Then I realized that I had an IP address, and I could ping google.  Then I realized I could still FTP (port 21 and 22), and then I tried accessing a website that uses port 8080 and it worked.  So I realized my problem was that port 80 was being blocked.  After a little searching I came across this blog that helped solve me problem:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://beer234.blogspot.com/2008/10/port-80-blocked-windows-xp.html" target="_blank"&gt;http://beer234.blogspot.com/2008/10/port-80-blocked-windows-xp.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The gist of it is that if VPN isn't properly uninstalled then it leaves behind a firewall that blocks port 80.  I have no clue why mine wasn't uninstalled properly. Anyways, if for some reason the link to the blog above doesn't work, here are the steps:&lt;ol&gt;&lt;li&gt;Restart the Windows XP PC in Safe Mode (press some combination of Shift, F5, F8 when booting up your computer)&lt;/li&gt;&lt;li&gt;Run Regedit.exe to open the registry editor&lt;/li&gt;&lt;li&gt;Navigate to HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\vsdatant&lt;/li&gt;&lt;li&gt;Select &lt;b&gt;start&lt;/b&gt; in the right pane and modify the value to 3 (mine was set to 2)&lt;/li&gt;&lt;li&gt;Restart the PC and port 80 should no longer be blocked and you can use http with any browser&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;Amazing that so many hours could be wasted and all it took was changing a 2 to a 3 in the registry!&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-6434817570235669123?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/6434817570235669123/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=6434817570235669123&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/6434817570235669123'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/6434817570235669123'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/03/vpn-blocking-port-80-not-flex-related.html' title='VPN Blocking port 80 (not Flex related)'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-1337950633812143761</id><published>2009-03-06T16:19:00.001-08:00</published><updated>2012-01-27T11:06:41.328-08:00</updated><title type='text'>Filtering and Highlighting Lists and DataGrids</title><content type='html'>I've written a &lt;code&gt;FilterBox&lt;/code&gt; control that filters the data inside &lt;code&gt;List&lt;/code&gt; and &lt;code&gt;DataGrid&lt;/code&gt; components, and another one that highlights items.&lt;br /&gt;&lt;br /&gt;See the example below for filtering and highlighting a List.  I've included a few extra item renderers for showing checkboxes, and for highlighting &lt;code&gt;DataGrid&lt;/code&gt; columns.&lt;br /&gt;(View source enabled)&lt;br /&gt;&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/filterbox/Sample.html" width="400" height="350"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;There are some limitations, such as it only highlights the first occurrence of the text.  And I probably could have used data binding instead of passing in a function to the &lt;code&gt;TextHighlighter&lt;/code&gt;, but hey - it's a work in progress.&lt;br /&gt;&lt;br /&gt;If you use the &lt;code&gt;FilterBox&lt;/code&gt; control, you might notice that it depends on a &lt;code&gt;ButtonBox&lt;/code&gt; component.  This is my implementation of a CheckBoxList, which has the same basic functionality as a &lt;code&gt;List&lt;/code&gt;, but maps each data item in the list to a CheckBox, and doesn't re-use item renderers the way Lists do.  This way you don't have to have a &lt;code&gt;selectedField&lt;/code&gt; property in your data.  I've noticed that the ButtonBox control doesn't scale very well if you have more than a few hundred items in the list.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-1337950633812143761?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/1337950633812143761/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=1337950633812143761&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/1337950633812143761'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/1337950633812143761'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/03/filtering-and-highlighting-lists-and.html' title='Filtering and Highlighting Lists and DataGrids'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-955386938920596306</id><published>2009-02-20T17:24:00.000-08:00</published><updated>2009-02-20T17:34:24.085-08:00</updated><title type='text'>Custom item renderers for Lists, ComboBoxes, and DataGrids</title><content type='html'>If you haven't already read these articles on creating custom item renderers then do so now, they will save you a lot of time.  I wish I had found them a few days ago!&lt;br /&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://blogs.adobe.com/aharui/2007/03/thinking_about_item_renderers_1.html" target="_blank"&gt;http://blogs.adobe.com/aharui/2007/03/thinking_about_item_renderers_1.html&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://blogs.adobe.com/aharui/2007/04/more_thinking_about_item_rende.html" target="_blank"&gt;http://blogs.adobe.com/aharui/2007/04/more_thinking_about_item_rende.html&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;Who thought that creating a &lt;code&gt;CheckBox&lt;/code&gt; list would be so difficult?  I've actually ended using a custom &lt;code&gt;CheckBoxList&lt;/code&gt; class that just puts &lt;code&gt;CheckBox&lt;/code&gt; components directly into a &lt;code&gt;VBox&lt;/code&gt; instead of using a &lt;code&gt;List&lt;/code&gt; with a &lt;code&gt;CheckBox&lt;/code&gt; itemRenderer because I was having too many difficulties getting it to work.  &lt;br /&gt;&lt;br /&gt;Most of my problems are cause by two things:&lt;br /&gt;&lt;li&gt;When filtering and scrolling the list I found that the checkboxes would lose their selected state.  I know the renderers are recycled, but I still couldn't get it to work consistently. &lt;/li&gt;&lt;br /&gt;&lt;li&gt;I had difficulty changing the selected property of my data items through ActionScript code (e.g. select all, select none, etc).  I couldn't get the renderers to update properly and have the right checked value.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;Most likely it is just my lack of understanding...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-955386938920596306?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/955386938920596306/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=955386938920596306&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/955386938920596306'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/955386938920596306'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/02/custom-item-renderers-for-lists.html' title='Custom item renderers for Lists, ComboBoxes, and DataGrids'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-9152133019482272667</id><published>2009-02-13T16:05:00.000-08:00</published><updated>2009-02-13T16:19:53.062-08:00</updated><title type='text'>Flex AutoComplete/Chooser component</title><content type='html'>I have been trying to use the &lt;a href="http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&amp;extid=1047291#" target="_blank"&gt;AutoComplete&lt;/a&gt; component from Adode for a few weeks now, and it has been rather painful.  I keep finding problems with it, and it has been frustrating my users a lot.  There is a &lt;a href="http://www.websector.de/blog/2008/04/30/quick-tip-avoid-issues-using-adobes-autocomplete-input-component-using-flex-3/" target="_blank"&gt;modified version&lt;/a&gt; by Jens Krause that is much better.&lt;br /&gt;&lt;br /&gt;But I still wasn't satisfied, so I started looking around for another auto-complete component, and came across this &lt;a href="http://hillelcoren.com/2008/11/10/flex-autocomplete-component-a-new-take-on-an-old-standard/" target="_blank"&gt;Chooser&lt;/a&gt; made by &lt;a href="http://hillelcoren.com" target="_blank"&gt;Hillel Coren&lt;/a&gt;.  Check it out, it's very powerful and best of all it's freely available.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-9152133019482272667?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/9152133019482272667/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=9152133019482272667&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/9152133019482272667'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/9152133019482272667'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/02/flex-autocompletechooser-component.html' title='Flex AutoComplete/Chooser component'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-8368489286569892142</id><published>2009-02-05T17:00:00.000-08:00</published><updated>2009-05-28T11:04:17.250-07:00</updated><title type='text'>Calling functions on applications loaded using SWFLoader</title><content type='html'>Following on from my last post on passing parameters to an application that is loaded using &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/SWFLoader.html" target="_blank"&gt;SWFLoader&lt;/a&gt;, this post will show you how to call a function on an application.&lt;br /&gt;Here is the code to load swf:&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;loader:SWFLoader&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;SWFLoader&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;loader.addEventListener&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;Event.INIT,&amp;nbsp;swfLoaded&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;loader.load&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;AnotherSWF.swf&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;And here is the code to handle adding the new swf content application:&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;swfLoaded&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;event:Event&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;:&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;content:DisplayObject&amp;nbsp;=&amp;nbsp;loader.content;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;Or&amp;nbsp;if&amp;nbsp;you&amp;nbsp;don't&amp;nbsp;have&amp;nbsp;the&amp;nbsp;loader:&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;content&amp;nbsp;=&amp;nbsp;event.target.content;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;add&amp;nbsp;loaded&amp;nbsp;SWF&amp;nbsp;to&amp;nbsp;a&amp;nbsp;UIComponent&amp;nbsp;to&amp;nbsp;show&amp;nbsp;it&amp;nbsp;on&amp;nbsp;the&amp;nbsp;screen&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;uicomponent.addChild&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;content&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;sysmgr:SystemManager&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;content&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;as&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;SystemManager&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;must&amp;nbsp;wait&amp;nbsp;for&amp;nbsp;the&amp;nbsp;swf&amp;nbsp;application&amp;nbsp;to&amp;nbsp;finish&amp;nbsp;loading&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;otherwise&amp;nbsp;the&amp;nbsp;application&amp;nbsp;is&amp;nbsp;null&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;sysmgr.addEventListener&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;FlexEvent.APPLICATION_COMPLETE,&amp;nbsp;swfAppComplete&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;And here is the code to call a function on the swf application:&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;swfAppComplete&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;event:FlexEvent&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;:&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;sysmgr:SystemManager&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;event.currentTarget&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;as&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;SystemManager&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;swfApp:Application&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;sysmgr.application&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;as&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;Application&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;call&amp;nbsp;your&amp;nbsp;function&amp;nbsp;here,&amp;nbsp;maybe&amp;nbsp;add&amp;nbsp;error&amp;nbsp;checking&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;if&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;swfApp.hasOwnProperty&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;helloWorld&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;))&amp;nbsp;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;helloWorld:Function&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;swfApp&lt;/font&gt;&lt;font color="#000000"&gt;[&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;helloWorld&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;]&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;as&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;Function&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;helloWorld&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;hi&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;b&gt;Note&lt;/b&gt; that the SWFLoader has 2 events that could be used:&lt;br /&gt;&lt;li&gt;&lt;code&gt;Event.COMPLETE ("complete")&lt;/code&gt; - dispatched when the content loading is done&lt;/li&gt;&lt;li&gt;&lt;code&gt;Event.INIT ("init")&lt;/code&gt; - dispatched when the properties and functions of the loaded SWF are accessible&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;If you want more reading on this subject, here is another good blog on &lt;a href="http://saturnboy.com/2009/04/nested-swf-communication/"&gt;Nested SWF communication&lt;/a&gt;.&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-8368489286569892142?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/8368489286569892142/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=8368489286569892142&amp;isPopup=true' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/8368489286569892142'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/8368489286569892142'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/02/calling-functions-on-applications.html' title='Calling functions on applications loaded using SWFLoader'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-6666111521015408552</id><published>2009-02-04T14:12:00.000-08:00</published><updated>2009-05-28T11:06:39.107-07:00</updated><title type='text'>Passing parameters to a loaded SWF application</title><content type='html'>Today I was trying to figure out how to load an SWF that contained another Flex Application and embed it into my main application.  This is the code that does it:&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;loader:SWFLoader&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;SWFLoader&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;loader.addEventListener&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;Event.COMPLETE,&amp;nbsp;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;event:Event&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;:&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;content:DisplayObject&amp;nbsp;=&amp;nbsp;loader.content;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;uicomponent.addChild&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;content&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;})&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;loader.load&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;SWFLoaderApp.swf&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;Then once I figured that out, I wanted to know how to pass parameters into the loaded SWF, and here is how that can be done. Change the load line to:&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#000000"&gt;loader.load&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;SWFLoaderApp.swf?test=hi&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;Then in your SWF application code, you should be able to get those parameters like this:&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;if&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;application.loaderInfo&amp;nbsp;!=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&amp;nbsp;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;url:String&amp;nbsp;=&amp;nbsp;application.loaderInfo.url;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;qm:int&amp;nbsp;=&amp;nbsp;url.lastIndexOf&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;?&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;if&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;qm&amp;nbsp;!=&amp;nbsp;-&lt;/font&gt;&lt;font color="#000000"&gt;1&lt;/font&gt;&lt;font color="#000000"&gt;)&amp;nbsp;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;query:String&amp;nbsp;=&amp;nbsp;url.substr&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;qm&amp;nbsp;+&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;1&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;params:Array&amp;nbsp;=&amp;nbsp;query.split&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;&amp;amp;&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;for&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;i:int&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;;&amp;nbsp;i&amp;nbsp;&amp;lt;&amp;nbsp;params.length;&amp;nbsp;i++&lt;/font&gt;&lt;font color="#000000"&gt;)&amp;nbsp;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;param:String&amp;nbsp;=&amp;nbsp;params&lt;/font&gt;&lt;font color="#000000"&gt;[&lt;/font&gt;&lt;font color="#000000"&gt;i&lt;/font&gt;&lt;font color="#000000"&gt;]&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;nameValue:Array&amp;nbsp;=&amp;nbsp;param.split&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;=&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;if&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;nameValue.length&amp;nbsp;==&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;2&lt;/font&gt;&lt;font color="#000000"&gt;)&amp;nbsp;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;key:String&amp;nbsp;=&amp;nbsp;nameValue&lt;/font&gt;&lt;font color="#000000"&gt;[&lt;/font&gt;&lt;font color="#000000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;]&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;val:String&amp;nbsp;=&amp;nbsp;nameValue&lt;/font&gt;&lt;font color="#000000"&gt;[&lt;/font&gt;&lt;font color="#000000"&gt;1&lt;/font&gt;&lt;font color="#000000"&gt;]&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;trace&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;key&amp;nbsp;+&amp;nbsp;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;=&amp;#34;&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;+&amp;nbsp;val&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;** &lt;b&gt;Update&lt;/b&gt;:&lt;br /&gt;After some more testing I noticed that the above code doesn't always reliably work.  And here is what I think is happening. When you start up your main application, the &lt;code&gt;Application.application&lt;/code&gt; property is set.  Then when you load an SWF using the above code, it shares this same application.  So, the better way to get at the parameters passed in through the &lt;code&gt;SWFLoader&lt;/code&gt; url is to simply get the &lt;code&gt;parameters&lt;/code&gt; property right from your second (loaded) application like this:&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#009900"&gt;//&amp;nbsp;inside&amp;nbsp;your&amp;nbsp;loaded&amp;nbsp;swf&amp;nbsp;application&lt;/font&gt;&lt;br/&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;params:Object&amp;nbsp;=&amp;nbsp;parameters;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;trace&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;test=&amp;#34;&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;+&amp;nbsp;params&lt;/font&gt;&lt;font color="#000000"&gt;[&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;test&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;])&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;From reading the documentation on the &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/core/Application.html#parameters" target="_blank"&gt;mx.core.Application&lt;/a&gt; page: &lt;br /&gt;&lt;blockquote&gt;&lt;i&gt;There are two sources of parameters: the query string of the Application's URL, and the value of the FlashVars HTML parameter (this affects only the main Application).&lt;/i&gt;&lt;/blockquote&gt;&lt;br /&gt;I found this blog quite helpful too in solving this problem:&lt;br /&gt;&lt;a href="http://rahulmainkar.blogspot.com/2007/11/swfloader-and-nested-application.html" target="_blank"&gt;http://rahulmainkar.blogspot.com/2007/11/swfloader-and-nested-application.html&lt;/a&gt;.&lt;br /&gt;&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-6666111521015408552?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/6666111521015408552/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=6666111521015408552&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/6666111521015408552'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/6666111521015408552'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/02/passing-parameters-to-loaded-swf.html' title='Passing parameters to a loaded SWF application'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-8455495391496392619</id><published>2009-01-28T15:49:00.000-08:00</published><updated>2009-05-28T11:07:24.154-07:00</updated><title type='text'>Accessing proxied object</title><content type='html'>When receiving objects back from a server, they are usually wrapped up as a &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/utils/ObjectProxy.html" target="_blank"&gt;ObjectProxy&lt;/a&gt;.  I wanted to know how I could access the protected &lt;b&gt;object&lt;/b&gt; property on the &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/utils/ObjectProxy.html" target="_blank"&gt;ObjectProxy&lt;/a&gt;, so here's how you do it:&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;import&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;mx.utils.ObjectProxy;&lt;/font&gt;&lt;br/&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;import&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;mx.utils.object_proxy;&lt;/font&gt;&lt;br/&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;import&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;mx.rpc.events.ResultEvent;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;&lt;br/&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;resultHandler&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;event:ResultEvent&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;:&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;proxy:ObjecyProxy&amp;nbsp;=&amp;nbsp;ObjectProxy&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;event.result&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;obj:Object&amp;nbsp;=&amp;nbsp;proxy.object_proxy::object;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;I found the solution from this useful website:&lt;br /&gt;&lt;a href="http://www.docsultant.com/site2/articles/flex_internals.html" target="_blank"&gt;http://www.docsultant.com/site2/articles/flex_internals.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-8455495391496392619?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/8455495391496392619/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=8455495391496392619&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/8455495391496392619'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/8455495391496392619'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/01/accessing-proxied-object.html' title='Accessing proxied object'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-5309234269596341018</id><published>2009-01-19T11:45:00.000-08:00</published><updated>2012-01-27T11:02:01.583-08:00</updated><title type='text'>FormItem label verticalAlign</title><content type='html'>As far as I've seen the label on &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/containers/FormItem.html"&gt;FormItem&lt;/a&gt;'s are always vertically aligned at the top.  I have no idea why the Adobe guys didn't add the expected "&lt;b&gt;verticalAlign&lt;/b&gt;" style to let the programmer choose where the label is positioned.&lt;br /&gt;&lt;br /&gt;Anyways, I've extended the default &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/containers/FormItem.html"&gt;mx.containers.FormItem&lt;/a&gt; control to add support for this style:&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#9900cc"&gt;&lt;b&gt;class&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;FormItemVerticalAlign&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;extends&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;FormItem&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;override&amp;nbsp;protected&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;updateDisplayList&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;w:Number,&amp;nbsp;h:Number&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;:&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;super&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;.updateDisplayList&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;w,&amp;nbsp;h&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;vertically&amp;nbsp;align&amp;nbsp;(top&amp;nbsp;by&amp;nbsp;default)&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;verticalAlign:String&amp;nbsp;=&amp;nbsp;getStyle&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;verticalAlign&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;if&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;verticalAlign&amp;nbsp;==&amp;nbsp;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;middle&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;itemLabel.y&amp;nbsp;=&amp;nbsp;Math.max&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;h&amp;nbsp;-&amp;nbsp;itemLabel.height&lt;/font&gt;&lt;font color="#000000"&gt;)&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;/&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;2&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;else&amp;nbsp;if&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;verticalAlign&amp;nbsp;==&amp;nbsp;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;bottom&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&amp;nbsp;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;padBottom:Number&amp;nbsp;=&amp;nbsp;getStyle&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;paddingBottom&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;itemLabel.y&amp;nbsp;=&amp;nbsp;Math.max&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;h&amp;nbsp;-&amp;nbsp;itemLabel.height&amp;nbsp;-&amp;nbsp;padBottom&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;}&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;E.g.&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/formitem/FormItemVerticalAlignment.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="370" height="240"&gt;&lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-5309234269596341018?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/5309234269596341018/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=5309234269596341018&amp;isPopup=true' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/5309234269596341018'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/5309234269596341018'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/01/formitem-label-verticalalign.html' title='FormItem label verticalAlign'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-1924936139099000198</id><published>2009-01-07T18:19:00.000-08:00</published><updated>2009-12-01T13:37:58.449-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='HTTPService'/><category scheme='http://www.blogger.com/atom/ns#' term='ObjectProxy'/><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><title type='text'>HTTPService performance of the various result formats</title><content type='html'>Today I was reading about the various result formats options available for using with &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/rpc/http/mxml/HTTPService.html"&gt;HTTPService&lt;/a&gt; requests.   These formats are:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;object (default)&lt;/b&gt; - the resulting xml is returned as an &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/utils/ObjectProxy.html"&gt;ObjectProxy&lt;/a&gt;, or an &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/collections/ArrayCollection.html"&gt;ArrayCollection&lt;/a&gt; of &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/utils/ObjectProxy.html"&gt;ObjectProxy&lt;/a&gt; objects&lt;ul&gt;&lt;li&gt;See my post about the ObjectProxy class and how to &lt;a href="http://flexdevtips.blogspot.com/2009/01/accessing-proxied-object.html"&gt;access the proxied object&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;array&lt;/b&gt; -  the root object is returned as the first item in an &lt;code&gt;Array&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;xml&lt;/b&gt; -  returns the well formed xml (as an &lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/xml/XMLNode.html"&gt;XMLNode&lt;/a&gt; object)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;e4x&lt;/b&gt; - returns the response as an &lt;a href="http://livedocs.adobe.com/flex/3/langref/XML.html"&gt;XML&lt;/a&gt; object&lt;/li&gt;&lt;li&gt;&lt;b&gt;flashvars&lt;/b&gt; - result is formatted into name=value pairs like "name=value&amp;amp;on=true"&lt;/li&gt;&lt;li&gt;&lt;b&gt;text&lt;/b&gt; - returns the response as a &lt;code&gt;String&lt;/code&gt; object&lt;/li&gt;&lt;/ul&gt;Have you ever wondered which one is the fastest?&lt;br /&gt;&lt;br /&gt;I ran some tests on an XML file that had 22,000 lines, and here are the results:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;object: 610ms&lt;/li&gt;&lt;li&gt;array: 600ms&lt;/li&gt;&lt;li&gt;xml: 244ms&lt;/li&gt;&lt;li&gt;flashvars: 121ms&lt;/li&gt;&lt;li&gt;text: 51ms&lt;/li&gt;&lt;li&gt;e4x: 113ms&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;And here is the code I used to calculate the times:&lt;br /&gt;&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;startTime:int;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;&lt;br/&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;loadXMLFile&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;format:String&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;:&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;service:HTTPService&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;HTTPService&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;service.url&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;huge.xml&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;located&amp;nbsp;in&amp;nbsp;the&amp;nbsp;project&amp;nbsp;src&amp;nbsp;directory&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;service.resultFormat&amp;nbsp;=&amp;nbsp;format;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;service.headers&lt;/font&gt;&lt;font color="#000000"&gt;[&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;Pragma&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;]&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;=&amp;nbsp;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;no-cache&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#009900"&gt;//&amp;nbsp;no&amp;nbsp;caching&amp;nbsp;of&amp;nbsp;the&amp;nbsp;file&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;service.headers&lt;/font&gt;&lt;font color="#000000"&gt;[&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;Cache-Control&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;]&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;=&amp;nbsp;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;no-cache&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;service.addEventListener&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;ResultEvent.RESULT,&amp;nbsp;resultHandler&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;startTime&amp;nbsp;=&amp;nbsp;getTimer&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;token:AsyncToken&amp;nbsp;=&amp;nbsp;service.send&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;token.resultFormat&amp;nbsp;=&amp;nbsp;format;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;br/&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#339966"&gt;&lt;b&gt;function&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;resultHandler&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;event:ResultEvent&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;:&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;time:int&amp;nbsp;=&amp;nbsp;getTimer&lt;/font&gt;&lt;font color="#000000"&gt;()&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;-&amp;nbsp;startTime;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;trace&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;event.token.resultFormat&amp;nbsp;+&amp;nbsp;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;:&amp;nbsp;&amp;#34;&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;+&amp;nbsp;time&amp;nbsp;+&amp;nbsp;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;ms&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;Notes: there are static constants for the 6 result formats in &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/rpc/http/mxml/HTTPService.html"&gt;HTTPService&lt;/a&gt;.&lt;br /&gt;I haven't done any calculations on how long it would take to parse the XML vs. working with the &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/utils/ObjectProxy.html "&gt;ObjectProxy&lt;/a&gt; objects.  And obviously if you are working with other files types besides XML then the results will be different.&lt;br /&gt;&lt;br /&gt;Out of curiosity I also tested how long it would take to load the same file using a different method using the &lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/net/URLLoader.html"&gt;URLLoader&lt;/a&gt; and &lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/net/URLRequest.html"&gt;URLRequest&lt;/a&gt; classes.  The result was usually around &lt;b&gt;80ms&lt;/b&gt;, but that was just to return the contents of the file.  When converted into an &lt;a href="http://livedocs.adobe.com/flex/3/langref/XML.html"&gt;XML&lt;/a&gt; object it was closer to &lt;b&gt;120ms&lt;/b&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-1924936139099000198?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/1924936139099000198/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=1924936139099000198&amp;isPopup=true' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/1924936139099000198'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/1924936139099000198'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2009/01/httpservice-performance-of-various.html' title='HTTPService performance of the various result formats'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-6630584588146809804</id><published>2008-12-12T14:30:00.000-08:00</published><updated>2012-01-27T10:59:20.200-08:00</updated><title type='text'>Resizable Movable Panel</title><content type='html'>Following on the examples I found at this blog &lt;a href="http://blogs.adobe.com/flexdoc/2007/03/creating_resizable_and_draggab.html" target="_blank"&gt;http://blogs.adobe.com/flexdoc/2007/03/creating_resizable_and_draggab.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;font color="#aa0000"&gt;** I've posted an updated version &lt;a href="http://flexdevtips.blogspot.com/2009/03/resizable-containers.html"&gt;here&lt;/a&gt; that has more advanced resize/move support&lt;/font&gt;&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;I created my own resizable window component which extends &lt;code&gt;TitleWindow&lt;/code&gt;.  It renders a small resize handle in the bottom right corner of the panel which the user can drag to resize the window.  To make the window resizable, set the &lt;code&gt;resizable&lt;/code&gt; property to true.&lt;br /&gt;&lt;br /&gt;The window can also be dragged by the titlebar to move it (assuming that it is the child of a container that uses an absolute layout).  To make the window movable, set the &lt;code&gt;movable&lt;/code&gt; property to true.  Then you'll see a drag handle in the titlebar.&lt;br /&gt;&lt;br /&gt;The example below uses the &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/managers/PopUpManager.html"&gt;PopUpManager&lt;/a&gt; to show the window as a popup (which lets the user move the panel around the screen). You can view the source from the context menu. This window also listens for Enter and Escape keyboard events which both hide the popup. The window is hardcoded to have a min width and height of 20, and a max width/height of the application's width/height.&lt;br /&gt;&lt;br /&gt;&lt;iframe src="http://chris.firlingcanada.com/flexdevtips/flex3/resizepanel/ResizePanel.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="450" height="450"&gt;&lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-6630584588146809804?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/6630584588146809804/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=6630584588146809804&amp;isPopup=true' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/6630584588146809804'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/6630584588146809804'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2008/12/resizable-window.html' title='Resizable Movable Panel'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-7090258787880818026</id><published>2008-12-11T19:22:00.000-08:00</published><updated>2009-05-28T11:10:24.736-07:00</updated><title type='text'>Dynamically changing the browser title in ActionScript</title><content type='html'>Many of you have probably set the &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/core/Application.html#pageTitle"&gt;Application.pageTitle&lt;/a&gt; property.  But as the documentation says, that property can only be set in MXML.  So how do you change it dynamically in ActionScript?&lt;br /&gt;&lt;br /&gt;One way that I found is to use the &lt;a href="http://livedocs.adobe.com/flex/3/langref/flash/external/ExternalInterface.html"&gt;ExternalInterface&lt;/a&gt; class and use JavaScript like this:&lt;br /&gt;&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#000000"&gt;ExternalInterface.call&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;eval(window.document.title&amp;nbsp;=&amp;nbsp;'New&amp;nbsp;Title')&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;Obviously you'd want to escape any single quotes in the new title.&lt;br /&gt;&lt;br /&gt;One other way I found to do this is using the &lt;a href="http://livedocs.adobe.com/flex/3/langref/mx/managers/BrowserManager.html"&gt;BrowserManager&lt;/a&gt;(if you have it enabled):&lt;br /&gt;&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;browser:IBrowserManager&amp;nbsp;=&amp;nbsp;BrowserManager.getInstance&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;browser.init&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;New&amp;nbsp;Title&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#009900"&gt;//&amp;nbsp;or&amp;nbsp;this&amp;nbsp;way:&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;browser.setTitle&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#990000"&gt;&lt;b&gt;&amp;#34;New&amp;nbsp;Title&amp;#34;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;Hope this helps!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-7090258787880818026?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/7090258787880818026/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=7090258787880818026&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7090258787880818026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7090258787880818026'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2008/12/dynamically-changing-browser-title-in.html' title='Dynamically changing the browser title in ActionScript'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4686657150124826716.post-7724239904873847197</id><published>2008-12-10T16:04:00.000-08:00</published><updated>2009-05-28T11:11:19.196-07:00</updated><title type='text'>Flex application slows down over time</title><content type='html'>I have been working on a simple Flex application that draws many rectangles in one of five different colors on a &lt;code&gt;Canvas&lt;/code&gt;. I created a &lt;code&gt;Sprite&lt;/code&gt; object which I used to do the drawing. At first I was drawing each rectangle like this:&lt;br /&gt;&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;g:Graphics&amp;nbsp;=&amp;nbsp;sprite.graphics;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;g.beginFill&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;0xff0000&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;1&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;g.drawRect&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;20&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;20&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;g.endFill&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;But I noticed when I was drawing hundreds of rectangles over time (using a &lt;code&gt;Timer&lt;/code&gt; object to paint new rectangles every few hundred milliseconds) this got to be pretty slow.&lt;br /&gt;So my next attempt to improve performance was to cache a &lt;code&gt;BitmapData&lt;/code&gt; object for each rectangle (they are all the same size) of a certain color:&lt;br /&gt;&lt;div align="left" class="code"&gt;&lt;table border="0" cellpadding="3" cellspacing="0"&gt;   &lt;tr&gt;   &lt;td nowrap="nowrap" valign="top" align="left"&gt;    &lt;code&gt;&lt;font color="#009900"&gt;//&amp;nbsp;initialize&amp;nbsp;the&amp;nbsp;cache&amp;nbsp;in&amp;nbsp;the&amp;nbsp;constructor&lt;/font&gt;&lt;br/&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;cache:Dictionary&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;Dictionary&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;&lt;br/&gt;&lt;font color="#009900"&gt;//&amp;nbsp;paint&amp;nbsp;each&amp;nbsp;rectangle:&lt;/font&gt;&lt;br/&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;color:uint&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;0xff0000&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#6699cc"&gt;&lt;b&gt;var&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;data:BitmapData&amp;nbsp;=&amp;nbsp;cache&lt;/font&gt;&lt;font color="#000000"&gt;[&lt;/font&gt;&lt;font color="#000000"&gt;color&lt;/font&gt;&lt;font color="#000000"&gt;]&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;if&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;data&amp;nbsp;==&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;)&amp;nbsp;{&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;data&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;BitmapData&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;20&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;20&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;&lt;/font&gt;&lt;font color="#0033ff"&gt;&lt;b&gt;false&lt;/b&gt;&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;color&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#ffffff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;cache&lt;/font&gt;&lt;font color="#000000"&gt;[&lt;/font&gt;&lt;font color="#000000"&gt;color&lt;/font&gt;&lt;font color="#000000"&gt;]&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;=&amp;nbsp;data;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;g.beginBitmapFill&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;data&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;g.drawRect&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;20&lt;/font&gt;&lt;font color="#000000"&gt;,&amp;nbsp;&lt;/font&gt;&lt;font color="#000000"&gt;20&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br/&gt;&lt;font color="#000000"&gt;g.endFill&lt;/font&gt;&lt;font color="#000000"&gt;()&lt;/font&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;/code&gt;       &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;This definitely improved the performance a lot, now I can draw hundreds of rectangles, but I still noticed that the rendering would slow down after a few minutes. Thankfully I came across this posting on Nabble: &lt;a href="http://www.nabble.com/-INFO--FLEX-Effects-slowing-down-with-time-td20770945.html" target="_blank"&gt;http://www.nabble.com/-INFO--FLEX-Effects-slowing-down-with-time-td20770945.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Perhaps this is obvious to most people, but I was never calling &lt;code&gt;graphics.clear()&lt;/code&gt;! So over time my sprite's graphics object was getting filled with thousands of rectangles to paint. As soon as I added &lt;code&gt;sprite.graphics.clear()&lt;/code&gt; to my &lt;code&gt;updateDisplayList()&lt;/code&gt; function it worked perfectly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4686657150124826716-7724239904873847197?l=flexdevtips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flexdevtips.blogspot.com/feeds/7724239904873847197/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4686657150124826716&amp;postID=7724239904873847197&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7724239904873847197'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4686657150124826716/posts/default/7724239904873847197'/><link rel='alternate' type='text/html' href='http://flexdevtips.blogspot.com/2008/12/flex-application-slows-down-over-time.html' title='Flex application slows down over time'/><author><name>Chris Callendar</name><uri>http://www.blogger.com/profile/14461038089756851470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-1gYcsElZk6g/TYuzKiuX2eI/AAAAAAAAA5w/wpot9IciYc8/s220/photo_me_small.jpg'/></author><thr:total>1</thr:total></entry></feed>
