<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Blue Flex &#187; actionscript</title>
	<atom:link href="http://kennethsutherland.com/category/actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://kennethsutherland.com</link>
	<description>Flex with a hint of cool</description>
	<lastBuildDate>Wed, 28 Sep 2011 14:12:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>Updating bindings when you only change a property inside an Object</title>
		<link>http://kennethsutherland.com/2011/08/30/updating-bindings-when-you-only-change-a-property-inside-an-object/</link>
		<comments>http://kennethsutherland.com/2011/08/30/updating-bindings-when-you-only-change-a-property-inside-an-object/#comments</comments>
		<pubDate>Tue, 30 Aug 2011 21:08:23 +0000</pubDate>
		<dc:creator>Kenneth</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[bindingManager]]></category>
		<category><![CDATA[Flex 3]]></category>
		<category><![CDATA[flex 4]]></category>

		<guid isPermaLink="false">http://kennethsutherland.com/?p=705</guid>
		<description><![CDATA[Its quite a common thing with Flex and actionscript projects to create an Object and inside that object it will have many properties.  Something in your view will be bound to the object so that the view changes with the object. So long as you change the entire object this will work fine. Where this [...]]]></description>
			<content:encoded><![CDATA[<p>Its quite a common thing with Flex and actionscript projects to create an Object and inside that object it will have many properties.  Something in your view will be bound to the object so that the view changes with the object. So long as you change the entire object this will work fine.</p>
<p>Where this doesn&#8217;t work is if you change a property inside the object.</p>
<p>So if we have something like this</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span>			
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> myObject : ObjectDataVO;
&nbsp;
<span style="color: #66cc66;">&lt;</span>view:SomeComponent
...
<span style="color: #0066CC;">data</span>=<span style="color: #ff0000;">&quot;{ myObject }&quot;</span>
...
<span style="color: #66cc66;">/&gt;</span></pre></div></div>

<p>When we set myObject to something the view component gets updated (great so far).<br />
Lets say the myObject has a property text and the view component uses this to display some visual label, then somewhere in the app I change that property, myObject.text = &#8220;something else&#8221;;<br />
The binding will not trigger as I haven&#8217;t actually changed the myObject, just a property inside it.</p>
<p>So how do we fire the binding manually? Well there is the <strong>BindingManager </strong>class (note this is an <em>excluded </em>class so you&#8217;ll not see it in the autocomplete ).<br />
So in this example if I changed the myObject.text property then I could call</p>
<p><span style="text-decoration: underline;"> BindingManager.executeBindings( this, &#8216;myObject.text&#8217;, myObject );</span></p>
<p>This would fire of the binding as if the actual myObject had changed so anything listening in will now get updated.</p>
<p style="text-align: center;"><script type="text/javascript"><!--
google_ad_client = "pub-7396620608505330";
google_ad_slot = "1277482570";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://kennethsutherland.com/2011/08/30/updating-bindings-when-you-only-change-a-property-inside-an-object/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Cross domain policy &#8211; Not to be used for release!</title>
		<link>http://kennethsutherland.com/2011/08/29/cross-domain-policy-not-to-be-used-for-release/</link>
		<comments>http://kennethsutherland.com/2011/08/29/cross-domain-policy-not-to-be-used-for-release/#comments</comments>
		<pubDate>Mon, 29 Aug 2011 14:29:15 +0000</pubDate>
		<dc:creator>Kenneth</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://kennethsutherland.com/?p=708</guid>
		<description><![CDATA[Sometimes I like to put something up on my blog that&#8217;s more as of a bookmark for myself as I know I&#8217;ll want to look it up at some point.  So what I&#8217;ve got here is a slack, open cross domain policy. DO NOT USE THIS IN YOUR PRODUCTION CODE (unless you really need to [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes I like to put something up on my blog that&#8217;s more as of a bookmark for myself as I know I&#8217;ll want to look it up at some point.  So what I&#8217;ve got here is a slack, open cross domain policy.</p>
<p><strong>DO NOT USE THIS IN YOUR PRODUCTION CODE</strong><br />
<strong> </strong><em> (unless you really need to and understand why you shouldn&#8217;t)</em></p>
<p>This will get rid of any security issues you may be having while in development.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #00bbdd;">&lt;!DOCTYPE cross-domain-policy SYSTEM</span>
<span style="color: #00bbdd;"> &quot;http://www.adobe.com/xml/dtds/cross-domain-policy.dtd&quot;&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;cross-domain-policy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;site-control</span> <span style="color: #000066;">permitted-cross-domain-policies</span>=<span style="color: #ff0000;">&quot;all&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;allow-access-from</span> <span style="color: #000066;">domain</span>=<span style="color: #ff0000;">&quot;*&quot;</span> <span style="color: #000066;">secure</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;allow-http-request-headers-from</span> <span style="color: #000066;">domain</span>=<span style="color: #ff0000;">&quot;*&quot;</span></span>
<span style="color: #009900;"> <span style="color: #000066;">headers</span>=<span style="color: #ff0000;">&quot;*&quot;</span> <span style="color: #000066;">secure</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/cross-domain-policy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p style="text-align: center;"><script type="text/javascript"><!--
google_ad_client = "pub-7396620608505330";
google_ad_slot = "1277482570";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://kennethsutherland.com/2011/08/29/cross-domain-policy-not-to-be-used-for-release/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IconItemRenderer and LabelItemRenderer, separator lines hardcoded!</title>
		<link>http://kennethsutherland.com/2011/08/23/iconitemrenderer-and-labelitemrenderer-separator-lines-hardcoded/</link>
		<comments>http://kennethsutherland.com/2011/08/23/iconitemrenderer-and-labelitemrenderer-separator-lines-hardcoded/#comments</comments>
		<pubDate>Tue, 23 Aug 2011 20:41:55 +0000</pubDate>
		<dc:creator>Kenneth</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[IconItemRenderer]]></category>

		<guid isPermaLink="false">http://kennethsutherland.com/?p=696</guid>
		<description><![CDATA[Working on a mobile project I needed to create a renderer for a list, so I choose to look at the IconItemRenderer which extends the LabelItemRenderer. These have been optimised for mobile use so it seemed a reasonable place to start. On the whole they seem like good classes to use, but if you&#8217;ve ever [...]]]></description>
			<content:encoded><![CDATA[<p>Working on a mobile project I needed to create a renderer for a list, so I choose to look at the IconItemRenderer which extends the LabelItemRenderer. These have been optimised for mobile use so it seemed a reasonable place to start. On the whole they seem like good classes to use, but if you&#8217;ve ever worked with the Datagrid/DataGridBase in the past you will probably know about the white square which comes about from the hardcoded #FFFFFF values inside the DataGridBase!</p>
<p>Well the IconItemRenderer and LabelItemRenderer have a similar issue. So lets just say you create a list and you wish to skin the list exactly how you like or use it in a tile layout or something other than vertical then you will find some lines above and below your renderers which look out of place.  You can&#8217;t get rid of them no matter what property styles you set.</p>
<p>The fix is pretty straight forward but why does there have to be some hardcoded values in something that is meant to be very versatile?</p>
<p>So inside the LabelItemRenderer around lines 881 you will see the following. It uses these values to draw separators whether you like it or not.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #009900; font-style: italic;">// separators are a highlight on the top and shadow on the bottom</span>
topSeparatorColor = 0xFFFFFF<span style="color: #000066; font-weight: bold;">;</span>
topSeparatorAlpha = <span style="color: #000066; font-weight: bold;">.</span>3<span style="color: #000066; font-weight: bold;">;</span>
bottomSeparatorColor = 0x000000<span style="color: #000066; font-weight: bold;">;</span>
bottomSeparatorAlpha = <span style="color: #000066; font-weight: bold;">.</span>3<span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

<p>So the quickest way of dealing with this is to override the drawBackground function in your own class which is created in LabelItemRenderer. This doesn&#8217;t get called from IconItemRenderer so you can quite simple copy the entire function and just remove the separator chunk and do not call super from your function which overrides the drawBackground.</p>
<p>Better still would be to change the hard coded values to styles from a CSS file.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> topSeparatorColor <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">uint</span> = <span style="color: #004993;">getStyle</span><span style="color: #000000;">&#40;</span> <span style="color: #990000;">'topSeparatorColor'</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> topSeparatorAlpha <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Number</span> = <span style="color: #004993;">getStyle</span><span style="color: #000000;">&#40;</span> <span style="color: #990000;">'topSeparatorAlpha'</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
topSeparatorAlpha = <span style="color: #004993;">isNaN</span><span style="color: #000000;">&#40;</span> topSeparatorAlpha <span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">?</span> <span style="color: #000000; font-weight:bold;">1</span> <span style="color: #000066; font-weight: bold;">:</span> topSeparatorAlpha<span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

<p>If you&#8217;re setting a Number just remember to check for NaN&#8217;s in case you haven&#8217;t set a style, uints default to 0 anyway.</p>
<p style="text-align: center;"><script type="text/javascript"><!--
google_ad_client = "pub-7396620608505330";
google_ad_slot = "1277482570";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://kennethsutherland.com/2011/08/23/iconitemrenderer-and-labelitemrenderer-separator-lines-hardcoded/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple tip #5 Create function to call any function with unknown args</title>
		<link>http://kennethsutherland.com/2011/08/03/simple-tip-5-create-function-to-call-any-function-with-unknown-args/</link>
		<comments>http://kennethsutherland.com/2011/08/03/simple-tip-5-create-function-to-call-any-function-with-unknown-args/#comments</comments>
		<pubDate>Wed, 03 Aug 2011 20:33:38 +0000</pubDate>
		<dc:creator>Kenneth</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://kennethsutherland.com/?p=674</guid>
		<description><![CDATA[The other day I wanted to create a function in a class that would take a Function as a parameter and an Array of arguments.  Much like callLater() does, but not doing the whole queuing thing until the next frame. So how do you call a function that may have any number of arguments. Well [...]]]></description>
			<content:encoded><![CDATA[<p>The other day I wanted to create a function in a class that would take a Function as a parameter and an Array of arguments.  Much like callLater() does, but not doing the whole queuing thing until the next frame.</p>
<p>So how do you call a function that may have any number of arguments. Well here is the code and it should speak for itself.</p>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; line-height: 18px; white-space: pre;"> </span></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"> <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> checkSomethingThenCallOtherFunction<span style="color: #000000;">&#40;</span>
    <span style="color: #004993;">method</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Function</span><span style="color: #000066; font-weight: bold;">,</span> args <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> = <span style="color: #0033ff; font-weight: bold;">null</span> <span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
 <span style="color: #000000;">&#123;</span>
    <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span> something<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span> <span style="color: #000066; font-weight: bold;">&amp;</span>lt<span style="color: #000066; font-weight: bold;">;</span> someMaxLimit <span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        <span style="color: #004993;">method</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">apply</span><span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">,</span> args <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
    <span style="color: #000000;">&#125;</span>
    <span style="color: #0033ff; font-weight: bold;">else</span>
    <span style="color: #000000;">&#123;</span>
        <span style="color: #009900; font-style: italic;">//do something else</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>So how easy is that? Pass in the function and an array of arguments, that&#8217;s all.</p>
<table width="100%">
<tr>
<td>
<p style="text-align: left;">
<a title="Simple tip #1" href="http://kennethsutherland.com/2010/09/17/simple-tip-4-gotach-datagrid-borders/" target="_self">Previous Tip<br />
</a>
</p>
</td>
<td>
<p style="text-align: right;">
</td>
</tr>
</table>
<p style="text-align: center;"><script type="text/javascript"><!--
google_ad_client = "pub-7396620608505330";
google_ad_slot = "1277482570";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://kennethsutherland.com/2011/08/03/simple-tip-5-create-function-to-call-any-function-with-unknown-args/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Additional compiler arguments &#8211; debug only code</title>
		<link>http://kennethsutherland.com/2011/01/07/additional-compiler-arguments-debug-only-code/</link>
		<comments>http://kennethsutherland.com/2011/01/07/additional-compiler-arguments-debug-only-code/#comments</comments>
		<pubDate>Fri, 07 Jan 2011 22:24:20 +0000</pubDate>
		<dc:creator>Kenneth</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://kennethsutherland.com/?p=618</guid>
		<description><![CDATA[Inserting code that will be excluded depending on compiler arguments]]></description>
			<content:encoded><![CDATA[<p>Many times you look something up, do it once and think cool I&#8217;ll remember that as it&#8217;s simple.  Then 1 year later you&#8217;ve forgotten the syntax and you can&#8217;t find that help/blog page where you learned about it the first time.<br />
Well I needed to add in some debug code that would only be there for debugging, and the last thing I want to do when building a release version is to scan through the code to remove it. So the ideal way is to use a conditional compiler argument.</p>
<p>So in Flashbuilder, under the project properties and then the Flex compiler properties you&#8217;ll see something like this</p>
<div id="attachment_620" class="wp-caption aligncenter" style="width: 610px"><a href="http://kennethsutherland.com/wordpress1/wp-content/uploads/2011/01/compiler_args1.png"><img class="size-full wp-image-620" title="Compiler Arguments" src="http://kennethsutherland.com/wordpress1/wp-content/uploads/2011/01/compiler_args1.png" alt="Compiler Arguments" width="600" height="179" /></a><p class="wp-caption-text">Example for custom arguments</p></div>
<p>So if you had the following defined, -define=CONFIG::DEBUG,true -define+=CONFIG::SOMETHING_ELSE,false</p>
<p>Then in code you could do the following.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">    CONFIG<span style="color: #000066; font-weight: bold;">::</span>DEBUG
    <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">test</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Boolean</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
    CONFIG<span style="color: #000066; font-weight: bold;">::</span>SOMETHING_ELSE
    <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> somethingElse<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
    <span style="color: #000000;">&#123;</span>
&nbsp;
    <span style="color: #000000;">&#125;</span></pre></div></div>

<p>The variable and function code will only be included if the compiler argument is true. So in the above example if you called the function &#8216;somethingElse()&#8217; then this would generate a build error as somethingElse() doesn&#8217;t exist. Change the argument to true and it will build fine.</p>
<p style="text-align: center;"><script type="text/javascript"><!--
google_ad_client = "pub-7396620608505330";
google_ad_slot = "1277482570";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://kennethsutherland.com/2011/01/07/additional-compiler-arguments-debug-only-code/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Simple tip #4 (GOTCHA) &#8211; Datagrid borders</title>
		<link>http://kennethsutherland.com/2010/09/17/simple-tip-4-gotach-datagrid-borders/</link>
		<comments>http://kennethsutherland.com/2010/09/17/simple-tip-4-gotach-datagrid-borders/#comments</comments>
		<pubDate>Fri, 17 Sep 2010 09:10:58 +0000</pubDate>
		<dc:creator>Kenneth</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://kennethsutherland.com/?p=594</guid>
		<description><![CDATA[simple tip on drawing borders around a Datagrid]]></description>
			<content:encoded><![CDATA[<p>More of a gotcha than a simple tip.</p>
<p>I was customising a DataGrid with various skin parts the other day (Flex 3) and could I get the borderskin to show, heck no! Its been a while since I had to create a DG from scratch so I&#8217;d obviously blacked out any previous pain with using the dammed DG.</p>
<p>Anyway why would the borderskin not show? I tried a simple solid border, nope. I tried a custom png graphic taken from Fireworks for the DG&#8217;s border, nope. I tried a programmatic skin border and guess what nope &#8211; nothing.  The issue was that I had the background alpha set to 1 (which is pretty normal!) and I had set the alternate row colours.</p>
<p>Setting the background alpha to something less than 1 revealed the border so I ended up fudging it by creating the programmatic skin border by whatever the borderThickness is outside the size of the DG.  <br />
So if the DG was meant to be 400px wide and borderThickness was 2, I made the DG 396px wide and drew the border outside that area.  This is what I&#8217;ve expect to happen automatically.</p>
<p>Can&#8217;t believe I&#8217;ve missed this/forgotten this before. Crappy DG.</p>
<table width="100%">
<tbody>
<tr>
<td>
<p style="text-align: left;"><a title="Simple tip #3" href="http://kennethsutherland.com/2009/06/12/simple-tip-3-utility-swc-library-project/" target="_self">Previous Tip<br />
</a></p>
</td>
<td>
<p style="text-align: right;">
<a title="Simple tip #5" href="http://kennethsutherland.com/2011/08/03/simple-tip-5-create-function-to-call-any-function-with-unknown-args/" target="_self">Next Tip<br />
</a>
</p>
</td>
</tr>
</tbody>
</table>
<p style="text-align: center;"><script type="text/javascript"><!--
google_ad_client = "pub-7396620608505330";
google_ad_slot = "1277482570";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://kennethsutherland.com/2010/09/17/simple-tip-4-gotach-datagrid-borders/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Doom and gloom or a new beginning</title>
		<link>http://kennethsutherland.com/2009/06/23/doom-and-gloom-or-a-new-beginning/</link>
		<comments>http://kennethsutherland.com/2009/06/23/doom-and-gloom-or-a-new-beginning/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 14:52:33 +0000</pubDate>
		<dc:creator>Kenneth</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[contractor]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://kennethsutherland.com/?p=537</guid>
		<description><![CDATA[Redundancy… world shrinking economy… depression… company cutbacks… is this a bleak time or is it a time to make and face new challenges in the RIA world (particularly in the Flex and Actionscript areas)? Well after the unfortunate news that the company I work for are no longer wishing to partake in the RIA party [...]]]></description>
			<content:encoded><![CDATA[<p>Redundancy… world shrinking economy… depression… company cutbacks… is this a bleak time or is it a time to make and face new challenges in the RIA world (particularly in the Flex and Actionscript areas)?</p>
<p>Well after the unfortunate news that the company I work for are no longer wishing to partake in the RIA party that&#8217;s changing the way we look at and use the web/desktop and hence are making myself redundant. I&#8217;m looking at this as a great opportunity to expand my knowledge so that I can work with as many forward thinking companies as possible that deal with Flex/Actionscript/AIR or for that matter any RIA technology.<br />
Also I should now have more time to create and sell my own components, of which I had a cracking idea this morning (more on this later hopefully).</p>
<p>Hect I’ll event look at Silverlight or JavaFX <img src='http://kennethsutherland.com/wordpress1/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  if I get the time or the chance. So anyone out there fancy taking on a new contractor with 4 years+ experience in Flex as well as a bunch of other languages I’ve used along the way before I even heard of Flex.</p>
<p>Feel free to contact me at this address.<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_Contact_657826195"
			class="flashmovie"
			width="300"
			height="50">
	<param name="movie" value="/flex/contact/Contact.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/flex/contact/Contact.swf"
			name="fm_Contact_657826195"
			width="300"
			height="50">
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>I’m going to continue to post hints and tips on anything I do as well as posting any new components so watch this space and feel free to contact me if you need any work done in the UK, remote working is always an option as well.</p>
<p style="text-align: center;"><script type="text/javascript"><!--
google_ad_client = "pub-7396620608505330";
google_ad_slot = "1277482570";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://kennethsutherland.com/2009/06/23/doom-and-gloom-or-a-new-beginning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple tip #2 &#8211; random colours</title>
		<link>http://kennethsutherland.com/2009/06/12/simple-tip-2-random-colours/</link>
		<comments>http://kennethsutherland.com/2009/06/12/simple-tip-2-random-colours/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 08:12:23 +0000</pubDate>
		<dc:creator>Kenneth</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[colours]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[utility]]></category>

		<guid isPermaLink="false">http://kennethsutherland.com/?p=502</guid>
		<description><![CDATA[Their are so many times I&#8217;ve used a random colour in my apps (mainly for testing) that I thought I&#8217;d add this way of using a getter method with actionscript to simplify the process. First of if you haven&#8217;t got one already, create a uiltily class so features that you use regulary across projects (you [...]]]></description>
			<content:encoded><![CDATA[<p>Their are so many times I&#8217;ve used a random colour in my apps (mainly for testing) that I thought I&#8217;d add this way of using a getter method with actionscript to simplify the process.</p>
<p>First of if you haven&#8217;t got one already, create a uiltily class so features that you use regulary across projects (you could turn this file into a SWC and reference that in you various projects &#8211; now that I think about it I explain this as simple tip #3 <img src='http://kennethsutherland.com/wordpress1/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  )</p>
<p>So inside your utility class place the following code</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> randomColour<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">uint</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">*</span> <span style="color: #004993;">uint</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MAX_VALUE</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Then lets just say you require a random colour for anything just call Utility.randomColour, no brackets, no = signs.  Because you&#8217;ve set the function as a getter using the function name will be enough.  This method also means that you don&#8217;t need to remember the max/min values for a colour.  The uint min and max values are the same as the the min/max values for colours.</p>
<p>e.g.</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Canvas</span> backgroundColor=<span style="color: #ff0000;">&quot;{Utility.randomColour}&quot;</span></span>
<span style="color: #000000;">   width=<span style="color: #ff0000;">&quot;600&quot;</span></span>
<span style="color: #000000;">   height=<span style="color: #ff0000;">&quot;600&quot;</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>Utility is the name of the class that holds my utility functions.</p>
<table width="100%">
<tr>
<td>
<p style="text-align: left;">
<a title="Simple tip #1" href="http://kennethsutherland.com/2009/05/22/simple-tip-1-custom-events/" target="_self">Previous Tip<br />
</a>
</p>
</td>
<td>
<p style="text-align: right;">
<a title="Simple tip #3" href="http://kennethsutherland.com/2009/06/12/simple-tip-3-utility-swc-library-project/" target="_self">Next Tip<br />
</a>
</p>
</td>
</tr>
</table>
<p style="text-align: center;"><script type="text/javascript"><!--
google_ad_client = "pub-7396620608505330";
google_ad_slot = "1277482570";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://kennethsutherland.com/2009/06/12/simple-tip-2-random-colours/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple tip #3 &#8211; Utility SWC (library project)</title>
		<link>http://kennethsutherland.com/2009/06/12/simple-tip-3-utility-swc-library-project/</link>
		<comments>http://kennethsutherland.com/2009/06/12/simple-tip-3-utility-swc-library-project/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 08:12:08 +0000</pubDate>
		<dc:creator>Kenneth</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[flex builder]]></category>
		<category><![CDATA[swc]]></category>
		<category><![CDATA[utility file]]></category>

		<guid isPermaLink="false">http://kennethsutherland.com/?p=509</guid>
		<description><![CDATA[Do you frequently use simple actionscript functions in more than one project. Perhaps you&#8217;ve got a function to do tracking, parse strings to dates, or return a random colour etc. I&#8217;m sure most folk will have struggled to think of what project they last used a generic function ABC in as they could do with [...]]]></description>
			<content:encoded><![CDATA[<p>Do you frequently use simple actionscript functions in more than one project. Perhaps you&#8217;ve got a function to do tracking, parse strings to dates, or return a random colour etc. </p>
<p>I&#8217;m sure most folk will have struggled to think of what project they last used a generic function ABC in as they could do with using it for project XYZ and would rather spend 30 mins searching for said function rather than rewrite it.</p>
<p>Well as explained below is a way to stop this from happening and hopefully save you a heap of time.</p>
<ul>
<li>
<h6>Step 1</h6>
<p> &#8211; Create a library project.</li>
<li>So using flexbuilder, go to File-&gt;New-&gt;Flex Library Project.</li>
<li>This will create an empty library project.</li>
</ul>
<ul>
<li>
<h6>Step 2</h6>
<p> &#8211; add in your Utilty class to the library project.</li>
<li>To do this add/create a Utility actionscript file that contains your static functions. Save, and this should then automaticlaly create a SWC file inside the library bin folder. (If it hasn&#8217;t and the file added has no errors then check the project properties to make sure the newly added file is being included &#8211; see pic)</li>
</ul>
<p><img class="aligncenter" title="Library path for adding files to SWC" src="/images/utility (Custom).JPG" alt="" width="600" height="185" /></p>
<ul>
<li>
<h6>Step 3</h6>
<p> &#8211; add the reference of the newly created SWC file to any project you intend to use it in.</li>
<li>So go to your project you wish to use the SWC with, then select the projects properties and inside &#8216;Flex build path&#8217; select &#8216;Add SWC&#8217;.</li>
<li>Browse to the the previous library project and select the SWC from its bin folder.</li>
</ul>
<p><img class="aligncenter" title="Adding a SWC to you project" src="/images/addSWC (Custom).JPG" alt="" width="600" height="222" /></p>
<p>You are now done, any time you update the code in the library project, those changes will be reflected in any project that references the SWC file automatically.</p>
<table width="100%">
<tr>
<td>
<p style="text-align: left;">
<a title="Simple tip #2" href="http://kennethsutherland.com/2009/06/12/simple-tip-2-random-colours/" target="_self">Previous Tip<br />
</a>
</p>
</td>
<td>
<p style="text-align: right;"><a title="Simple tip #4" href="http://kennethsutherland.com/2010/09/17/simple-tip-4-gotach-datagrid-borders/" target="_self">Next Tip<br />
</a>
</p>
</td>
</tr>
</table>
<p style="text-align: center;"><script type="text/javascript"><!--
google_ad_client = "pub-7396620608505330";
google_ad_slot = "1277482570";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://kennethsutherland.com/2009/06/12/simple-tip-3-utility-swc-library-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Show dual coloured highlight for a DG</title>
		<link>http://kennethsutherland.com/2009/06/11/show-dual-coloured-highlight-for-a-dg/</link>
		<comments>http://kennethsutherland.com/2009/06/11/show-dual-coloured-highlight-for-a-dg/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 15:02:48 +0000</pubDate>
		<dc:creator>Kenneth</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[advanceddatagrid]]></category>
		<category><![CDATA[datagrid]]></category>
		<category><![CDATA[drawHighlightIndicator]]></category>

		<guid isPermaLink="false">http://kennethsutherland.com/?p=491</guid>
		<description><![CDATA[If you have a datagrid that has different coloured columns, then why should you have to do with only using a single colour for the highlight. Below is a simple soloution using actionscript to solve this. First I should state that you need to use the AdvancedDataGrid even if you only need a normal DataGrid. [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a datagrid that has different coloured columns, then why should you have to do with only using a single colour for the highlight.</p>
<p>Below is a simple soloution using actionscript to solve this.</p>
<p>First I should state that you need to use the AdvancedDataGrid even if you only need a normal DataGrid.  This is because the AdvancedDataGrid has a method called drawHighlightIndicator(&#8230;), which as you&#8217;d expect from the name draws the highlight.  Normally this is a single colour, but with a little overriding you&#8217;ll be able to change this.</p>
<p>Below is the main snippet of code from the extended AdvancedDataGrid.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> drawHighlightIndicator<span style="color: #000000;">&#40;</span>  indicator<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Sprite</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000066; font-weight: bold;">,</span>
	<span style="color: #004993;">width</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">height</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">color</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">uint</span><span style="color: #000066; font-weight: bold;">,</span>  itemRenderer<span style="color: #000066; font-weight: bold;">:</span>IListItemRenderer<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #009900; font-style: italic;">//The indicator is the highlight, so grab its graphics and clear them</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> g<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Graphics</span> = <span style="color: #004993;">Sprite</span><span style="color: #000000;">&#40;</span>indicator<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">;</span>
	g<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">clear</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #6699cc; font-weight: bold;">var</span> xPos <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> yPos <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #009900; font-style: italic;">//loop through the number of columns in the datagrid</span>
	<span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">uint</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span> i <span style="color: #000066; font-weight: bold;">&amp;</span>lt<span style="color: #000066; font-weight: bold;">;</span> <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>columnCount<span style="color: #000066; font-weight: bold;">;</span> i<span style="color: #000066; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
		<span style="color: #009900; font-style: italic;">//get a random colour</span>
		g<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span>randColour<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #009900; font-style: italic;">//draw the rectanlge that fills the first column</span>
		g<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span>xPos<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>columns<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">height</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #009900; font-style: italic;">//update the starting X position so that it starts at the begin of the</span>
		<span style="color: #009900; font-style: italic;">//next column</span>
		xPos = xPos <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>columns<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #000000;">&#125;</span>
	g<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">endFill</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>using the above you could create a DataGrid like the below which has some left hand columns in light purple and the rest in white. Then on highlight that same light purple colour is used for the white cells and the existing light purple becomes a slightly darker purple.</p>
<p><img class="aligncenter" title="Twin DG colour example" src="/flex/june09/TwinHighlight/twinDGColour.JPG" alt="Twin DG colour example" width="389" height="175" /></p>
<p>Check out this <a title="Twin coloured DG highlight" href="http://www.kennethsutherland.com/flex/june09/TwinHighlight/demoTwinHighlight.html" target="_blank">link to see a very simple/colourful demo</a>. As ever right click app for full source code.</p>
<p style="text-align: center;"><script type="text/javascript"><!--
google_ad_client = "pub-7396620608505330";
google_ad_slot = "1277482570";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://kennethsutherland.com/2009/06/11/show-dual-coloured-highlight-for-a-dg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

