<?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>Architect, Engineer, Tech Enthusiast - Hasan Otuome &#187; AIR</title>
	<atom:link href="http://technophi.com/tag/air/feed/" rel="self" type="application/rss+xml" />
	<link>http://technophi.com</link>
	<description>personal weblog of a tech addict</description>
	<lastBuildDate>Wed, 18 Aug 2010 17:59:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Flex 4 &#8211; Base64 Image Decompression and Decoding</title>
		<link>http://technophi.com/2010/08/18/flex-4-base64-image-decompression-and-decoding/</link>
		<comments>http://technophi.com/2010/08/18/flex-4-base64-image-decompression-and-decoding/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 12:04:11 +0000</pubDate>
		<dc:creator>Hasan Otuome</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://technophi.com/?p=536</guid>
		<description><![CDATA[If you ever run into a situation where you need/want to work with Base64-encoded images using AMF, here&#8217;s an example of the process involved in retrieving the encoded data packed with GZip compression from the backend. Source view is enabled on the SWF and the AMFPHP service used are included as well. To view the [...]]]></description>
			<content:encoded><![CDATA[<p>If you ever run into a situation where you need/want to work with Base64-encoded images using AMF, here&#8217;s an example of the process involved in retrieving the encoded data packed with GZip compression from the backend. Source view is enabled on the SWF and the AMFPHP service used are included as well. </p>
<p>To view the demo in its own window, click <a href="http://technophi.com/examples/base64/Base64Decompressor.html">here</a>.<br />
<br/></p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_Base64Decompressor_1674123820"
			class="flashmovie"
			width="955"
			height="600">
	<param name="movie" value="/examples/base64/Base64Decompressor.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/examples/base64/Base64Decompressor.swf"
			name="fm_Base64Decompressor_1674123820"
			width="955"
			height="600">
	<!--<![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>
]]></content:encoded>
			<wfw:commentRss>http://technophi.com/2010/08/18/flex-4-base64-image-decompression-and-decoding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash Builder 4 &#8211; Java Heap Space Issues</title>
		<link>http://technophi.com/2010/08/12/flash-builder-4-java-heap-space-issues/</link>
		<comments>http://technophi.com/2010/08/12/flash-builder-4-java-heap-space-issues/#comments</comments>
		<pubDate>Fri, 13 Aug 2010 01:10:51 +0000</pubDate>
		<dc:creator>Hasan Otuome</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://technophi.com/?p=528</guid>
		<description><![CDATA[If you ever experience a message like &#8220;Error: Java Heap Space&#8221; when building, cleaning or generating a bin-release for a project in Flash Builder 4, try the following as a remedy: 1. Open the following files: a) /install_dir/sdks/3.5.0/bin/jvm.config b) /install_dir/sdks/4.0.0/bin/jvm.config 2. Locate the following line found under # Arguments to VM: java.args=-Xmx384m -Dsun.io.useCanonCaches=false 3. Increase [...]]]></description>
			<content:encoded><![CDATA[<p>If you ever experience a message like &#8220;Error: Java Heap Space&#8221; when building, cleaning or generating a bin-release for a project in Flash Builder 4, try the following as a remedy:</p>
<p>1. Open the following files:<br />
	a) /install_dir/sdks/3.5.0/bin/jvm.config<br />
	b) /install_dir/sdks/4.0.0/bin/jvm.config</p>
<p>2. Locate the following line found under # Arguments to VM:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">java.args=-Xmx384m -Dsun.io.useCanonCaches=<span style="color: #c20cb9; font-weight: bold;">false</span></pre></div></div>

<p>3. Increase the memory size to a larger value like the following example:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">java.args=-Xmx512m -Dsun.io.useCanonCaches=<span style="color: #c20cb9; font-weight: bold;">false</span></pre></div></div>

<p>The max you set this value to is determined by your available memory along with some workflow considerations but this should alleviate your heap issues and smooth out Flash Builder compilations considerably&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://technophi.com/2010/08/12/flash-builder-4-java-heap-space-issues/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Upgrading Flash Builder</title>
		<link>http://technophi.com/2010/03/01/upgrading-flash-builder/</link>
		<comments>http://technophi.com/2010/03/01/upgrading-flash-builder/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 04:46:56 +0000</pubDate>
		<dc:creator>Hasan Otuome</dc:creator>
				<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://technophi.com/?p=438</guid>
		<description><![CDATA[Whether you&#8217;re upgrading because you&#8217;re using BETA versions that change rather frequently or upgrading to the next major release, you don&#8217;t want to lose all your hard work invested in configuring your setup. Here&#8217;s how I handle it and hopefully it&#8217;s useful to you. If you have other cool ways to persist workflows between upgrades, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://technophi.com/wp-content/uploads/ol_upgrade_flashbuilder.png"><img src="http://technophi.com/wp-content/uploads/ol_upgrade_flashbuilder.png" alt="" title="upgrading flashbuilder" width="603" height="351" class="aligncenter size-full wp-image-440" /></a></p>
<p>Whether you&#8217;re upgrading because you&#8217;re using BETA versions that change rather frequently or upgrading to the next major release, you don&#8217;t want to lose all your hard work invested in configuring your setup. Here&#8217;s how I handle it and hopefully it&#8217;s useful to you. If you have other cool ways to persist workflows between upgrades, please share them.</p>
<h4>Workspaces</h4>
<p>I&#8217;ve created a <strong>workspaces</strong> folder in a custom directory on my HD where I store all the workspaces I like to use with Eclipse-based IDEs. I separate them by IDE and then by purpose. So for Flash Builder, my workspace hierarchy is like this:</p>
<pre>
/workspaces
  /_fb4
    /air
    /as
    /flash
    /flex
</pre>
<p>This is where all of my IDE preferences and workbench layout settings are stored. Centralizing them here allows me greater flexibility when upgrading since I never have to worry about any changes to installation procedures overwriting my custom settings. Nevertheless, I backup my workspaces prior to upgrading and since their small text files it only takes a second to archive.</p>
<h4>Documents Directory</h4>
<p>On OSX, the Flash Builder installer creates an <strong>Adobe Flash Builder 4</strong> directory in your Documents directory. The installation instructions advise you to uninstall any previous versions of Flash Builder before installing the new version. Following this advice will delete this folder if it already exists. So, be sure to back this up prior to uninstalling your current version. That way you can cherry pick anything you need after installing the new version.</p>
<h4>Applications Directory</h4>
<p>You should also backup up your program installation in your Applications directory for the same reasons as with the folder in your Documents directory. If you&#8217;ve heavily modified your install with additional plugins, etc., this is vital!</p>
<h4>Plugin Restoration</h4>
<p>Where are all my cool plugins? They got wiped during the upgrade process but if you followed my advice and backed everything up, you&#8217;ll be back up and running in a minute or two. There are generally (2) locations where plugin info is stored for Flash Builder. If you pull the data from your backups and place them in the following locations, you should have full access to all your plugins post-upgrade (provided they still work with the latest release) </p>
<p>#1 &#8211; /Documents/Adobe Flash Builder 4/.metadata/.plugins<br />
#2 &#8211; /Applications/Adobe Flash Builder 4/plugins</p>
<p>Although this post is slanted more towards upgrading on OSX, it should be similar for other operating systems. Any issues, let me know&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://technophi.com/2010/03/01/upgrading-flash-builder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using a Custom AdvancedDataGridHeaderRenderer to Display a Custom Image</title>
		<link>http://technophi.com/2010/02/09/using-a-custom-advanceddatagridheaderrenderer-to-display-a-custom-image/</link>
		<comments>http://technophi.com/2010/02/09/using-a-custom-advanceddatagridheaderrenderer-to-display-a-custom-image/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 18:38:07 +0000</pubDate>
		<dc:creator>Hasan Otuome</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flash Platform]]></category>

		<guid isPermaLink="false">http://technophi.com/?p=385</guid>
		<description><![CDATA[You decide to use an AdvancedDataGrid to display your data and for one of the columns you would prefer to use an icon instead of a text label to indicate the kind of data this column represents. First step is building the renderer. You can use either MXML or ActionScript but for this example we&#8217;ll [...]]]></description>
			<content:encoded><![CDATA[<p>You decide to use an AdvancedDataGrid to display your data and for one of the columns you would prefer to use an icon instead of a text label to indicate the kind of data this column represents. </p>
<p>First step is building the renderer. You can use either MXML or ActionScript but for this example we&#8217;ll use ActionScript.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> labs.otuome.ui.renderers
<span style="color: #000000;">&#123;</span>
  <span style="color: #0033ff; font-weight: bold;">import</span> mx.controls.Button;
  <span style="color: #0033ff; font-weight: bold;">import</span> mx.controls.advancedDataGridClasses.AdvancedDataGridHeaderRenderer;
&nbsp;
  <span style="color: #3f5fbf;">/**
   * Custom header renderer for displaying 
   * a graphical image in the column header.
   * @author Hasan Otuome
   */</span>
  <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> StatusHeaderRenderer extends AdvancedDataGridHeaderRenderer
  <span style="color: #000000;">&#123;</span>                                                                                          
    <span style="color: #009900;">/////////////////////////////////////////////////////////////////////////////////////////</span>
    <span style="color: #009900;">// PRIVATE PROPERTIES                                                                    </span>
    <span style="color: #009900;">/////////////////////////////////////////////////////////////////////////////////////////</span>
    <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _btn<span style="color: #000000; font-weight: bold;">:</span>Button;                                                                 
    <span style="color: #0033ff; font-weight: bold;">private</span> const LEFT_PADDING<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">12</span>;                                                     
    <span style="color: #009900;">/////////////////////////////////////////////////////////////////////////////////////////</span>
    <span style="color: #009900;">// PUBLIC PROPERTIES                                                                     </span>
    <span style="color: #009900;">/////////////////////////////////////////////////////////////////////////////////////////</span>
&nbsp;
    <span style="color: #009900;">/////////////////////////////////////////////////////////////////////////////////////////</span>
    <span style="color: #009900;">// PUBLIC METHODS                                                                        </span>
    <span style="color: #009900;">/////////////////////////////////////////////////////////////////////////////////////////</span>
    <span style="color: #3f5fbf;">/**
     * Constructor 
     */</span>		
    <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> StatusHeaderRenderer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
      <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #009900;">/////////////////////////////////////////////////////////////////////////////////////////</span>
    <span style="color: #009900;">// OVERRIDES</span>
    <span style="color: #009900;">/////////////////////////////////////////////////////////////////////////////////////////</span>
    <span style="color: #3f5fbf;">/**
     * Override to add the custom component. 
     */</span>		
    override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> createChildren<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
    <span style="color: #000000;">&#123;</span>
      <span style="color: #0033ff; font-weight: bold;">super</span>.createChildren<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
      _btn = <span style="color: #0033ff; font-weight: bold;">new</span> Button<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
      _btn.<span style="color: #004993;">width</span> = <span style="color: #000000; font-weight:bold;">16</span>;
      _btn.<span style="color: #004993;">height</span> = <span style="color: #000000; font-weight:bold;">16</span>;
      _btn.<span style="color: #004993;">setStyle</span><span style="color: #000000;">&#40;</span> <span style="color: #990000;">'skin'</span>, StatusMarkerHeaderIconSkin <span style="color: #000000;">&#41;</span>;
&nbsp;
      <span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span> _btn <span style="color: #000000;">&#41;</span>;
    <span style="color: #000000;">&#125;</span>
    <span style="color: #3f5fbf;">/**
     * Override to layout the children 
     * @param unscaledWidth
     * @param unscaledHeight
     */</span>		
    override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> updateDisplayList<span style="color: #000000;">&#40;</span> unscaledWidth<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>, 
                                                  unscaledHeight<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> <span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
    <span style="color: #000000;">&#123;</span>
      _btn.<span style="color: #004993;">x</span> = LEFT_PADDING;
&nbsp;
      <span style="color: #0033ff; font-weight: bold;">super</span>.updateDisplayList<span style="color: #000000;">&#40;</span> unscaledWidth, unscaledHeight <span style="color: #000000;">&#41;</span>;
    <span style="color: #000000;">&#125;</span>
    <span style="color: #009900;">/////////////////////////////////////////////////////////////////////////////////////////</span>
    <span style="color: #009900;">// PRIVATE METHODS</span>
    <span style="color: #009900;">/////////////////////////////////////////////////////////////////////////////////////////</span>
  <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Here we&#8217;ve added a 16&#215;16 button with a custom skin that will serve as our column header and we adjust the position of the custom skin so that it displays where we&#8217;d like it to.</p>
<p>Now, we can provide this class name to our AdvancedDataGridColumn that we wish to customize. We do this by assigning our custom class to the headerRenderer property of the AdvancedDataGridColumn. This property can be set via MXML or ActionScript. I&#8217;ll show an example in ActionScript as that approach is slightly more involved.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">import</span> mx.core.ClassFactory; 
myADGColumn.headerRenderer = <span style="color: #0033ff; font-weight: bold;">new</span> ClassFactory<span style="color: #000000;">&#40;</span> StatusHeaderRenderer <span style="color: #000000;">&#41;</span>;</pre></div></div>

<p>Here we&#8217;ve used ClassFactory to get an instance of our custom renderer and we&#8217;ve assigned that instance to our chosen data grid column. Now, all that&#8217;s left to do is compile our application to see the result.</p>
<p><a href="http://technophi.com/wp-content/uploads/olgk_custom_header.png"><img src="http://technophi.com/wp-content/uploads/olgk_custom_header-300x195.png" alt="" title="olgk_custom_header" width="300" height="195" class="aligncenter size-medium wp-image-388" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://technophi.com/2010/02/09/using-a-custom-advanceddatagridheaderrenderer-to-display-a-custom-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Joining the Adobe Community Professionals for 2010</title>
		<link>http://technophi.com/2010/01/18/joining-the-adobe-community-professionals-for-2010/</link>
		<comments>http://technophi.com/2010/01/18/joining-the-adobe-community-professionals-for-2010/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 03:33:19 +0000</pubDate>
		<dc:creator>Hasan Otuome</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Community]]></category>

		<guid isPermaLink="false">http://technophi.com/?p=371</guid>
		<description><![CDATA[Formerly the Adobe Community Experts program, this is a collective of awesome individuals who exhibit expertise in various Adobe product areas from Acrobat to Photoshop, Flash, Cold Fusion, Flex, AIR and many, many more. Comprised of community leaders, this group has a worldwide presence and expounds the virtues of Adobe to the masses through the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://lizfrederick.blogspot.com/2010/01/adobe-community-professionals.html">Formerly the Adobe Community Experts program</a>, this is a collective of awesome individuals who exhibit expertise in various Adobe product areas from Acrobat to Photoshop, Flash, Cold Fusion, Flex, AIR and many, many more. Comprised of community leaders, this group has a worldwide presence and expounds the virtues of Adobe to the masses through the sharing of their time and expertise.</p>
<p>I&#8217;m truly honored to have been <a href="http://lizfrederick.blogspot.com/2010/01/new-acps-for-2010.html">chosen as a member</a> of this select group and look forward to expanding my community efforts throughout this new year. Having missed FlashCamp Brasil this past weekend, this revelation makes the trip to FITC Amsterdam that much more rewarding. See you there!!</p>
]]></content:encoded>
			<wfw:commentRss>http://technophi.com/2010/01/18/joining-the-adobe-community-professionals-for-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing Opticon Runtime Debugger</title>
		<link>http://technophi.com/2010/01/09/introducing-opticon-runtime-debugger/</link>
		<comments>http://technophi.com/2010/01/09/introducing-opticon-runtime-debugger/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 12:49:48 +0000</pubDate>
		<dc:creator>Hasan Otuome</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://technophi.com/?p=340</guid>
		<description><![CDATA[Opticon is a runtime debugging console useful for Flash/Flex developers. It&#8217;s simple to start using in your projects. To use, follow these steps after installing the application: 1. Launch the application 2. Click the Settings button 3. Click on the SWC icon to add the OpticonConnector to your project&#8217;s build path 4. Replace your trace [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://technophi.com/wp-content/uploads/ol_opticon_adm_banner_495x250.png" alt="ol_opticon_adm_banner_495x250" title="ol_opticon_adm_banner_495x250" width="495" height="250" class="aligncenter size-full wp-image-348" /></p>
<p>Opticon is a runtime debugging console useful for Flash/Flex developers. It&#8217;s simple to start using in your projects. To use, follow these steps after installing the application:</p>
<p>1. Launch the application<br />
2. Click the Settings button<br />
3. Click on the SWC icon to add the OpticonConnector to your project&#8217;s build path<br />
4. Replace your trace statements with one of the following:</p>
<ul style="list-style-type:none">
<li> a) <font color="green">Opticon.log(&#8216;message to display&#8217;)</font></li>
<li> b) <font color="darkorange">Opticon.warning(&#8216;warning to display&#8217;)</font></li>
<li> c) <font color="#cc0000">Opticon.error(&#8216;error to display&#8217;)</font></li>
</ul>
<p>Download available from:<br />
<a href="http://www.adobe.com/cfusion/marketplace/index.cfm?event=marketplace.offering&#038;offeringid=17303">Adobe AIR Marketplace</a><br />
<a href="http://opticon.riaforge.org">RIAForge</a></p>
<p><strong><em>Some might ask why?</strong></em> This idea first appeared when AIR was Apollo and was born out of necessity (I always forget some trace statements during cleanup). Could I use global find and replace? Sure, when I&#8217;m developing with Eclipse-based IDEs but that&#8217;s not always the case.</p>
<p><strong><em>Why not use one of the other great tools out there?</strong></em> After 2 years in the shadows, it&#8217;s ready to be shared with the world and, because I have a vision of where I&#8217;d like to take this so hopefully you&#8217;ll come along for the ride.</p>
<p><strong><em>Where can I submit any bugs I find?</strong></em> I&#8217;ll have the bug reporting mechanism in place shortly. You&#8217;ll be notified via the application or you can subscribe to this post to be notified once that goes live.</p>
<p><strong><em>My version doesn&#8217;t include the connector. What can I do?</strong></em> This happened as a result of a build error. Visit this link to download the connector <a href="http://labs.otuome.com/get/OpticonConnector">Get Opticon Connector</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://technophi.com/2010/01/09/introducing-opticon-runtime-debugger/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Double-headed Arrows with GraphicsUtil</title>
		<link>http://technophi.com/2009/12/07/double-headed-arrows-with-graphicsutil/</link>
		<comments>http://technophi.com/2009/12/07/double-headed-arrows-with-graphicsutil/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 20:00:03 +0000</pubDate>
		<dc:creator>Hasan Otuome</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://technophi.com/?p=333</guid>
		<description><![CDATA[I recently ran across this awesome utility class, GraphicsUtil, created by Noel Billig. It allows the ability to draw lines with an arrow on one end using the drawing API in AS3. This proved useful for a project I was working on. In addition to its default behavior however, I needed the utility class to [...]]]></description>
			<content:encoded><![CDATA[<p>I recently ran across this awesome utility class, <a href="http://www.dncompute.com/blog/2008/07/17/graphicsutil-a-utility-class-for-drawing-arrows.html">GraphicsUtil</a>, created by Noel Billig. It allows the ability to draw lines with an arrow on one end using the drawing API in AS3. This proved useful for a project I was working on. In addition to its default behavior however, I needed the utility class to provide the ability to draw lines with arrows on both ends. Well thanks to Noel&#8217;s clean code, I was able to easily modify the base class to do just that by adding the following static method:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #3f5fbf;">/**
 * Draws a double-headed arrow. Pass in ArrowStyle
 * objects for both arrows to override the default settings.
 * @param graphics
 * @param start
 * @param end
 * @param startStyle
 * @param endStyle
 */</span>
<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> drawArrows<span style="color: #000000;">&#40;</span> <span style="color: #004993;">graphics</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Graphics</span>,
        <span style="color: #004993;">start</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>,end<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>,
        startStyle<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Object</span>=<span style="color: #0033ff; font-weight: bold;">null</span>,
        endStyle<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Object</span>=<span style="color: #0033ff; font-weight: bold;">null</span> <span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #009900;">// variables used for arrow 1</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> startArrowStyle<span style="color: #000000; font-weight: bold;">:</span>ArrowStyle;
	<span style="color: #6699cc; font-weight: bold;">var</span> startHalfWidth<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> vect1<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> startNorm<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> start1<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> start2<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> end1<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> end2<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> startHeadPnt<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> startHeadPntNorm<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> startEdge1<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> startEdge2<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> startShaftCenter<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> startInter1<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> startInter2<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> startEdgeCenter<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> startEdgeNorm<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> startEdgeCntrl1<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> startEdgeCntrl2<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
&nbsp;
	<span style="color: #009900;">// variables used for arrow 2</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> endArrowStyle<span style="color: #000000; font-weight: bold;">:</span>ArrowStyle;
	<span style="color: #6699cc; font-weight: bold;">var</span> endHalfWidth<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> vect2<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> endNorm<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> end3<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> end4<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> start3<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> start4<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> endHeadPnt<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> endHeadPntNorm<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> endEdge1<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> endEdge2<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> endShaftCenter<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> endInter1<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> endInter2<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> endEdgeCenter<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> endEdgeNorm<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> endEdgeCntrl1<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
	<span style="color: #6699cc; font-weight: bold;">var</span> endEdgeCntrl2<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span>;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">start</span>.<span style="color: #004993;">equals</span><span style="color: #000000;">&#40;</span>end<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">return</span>;
&nbsp;
	<span style="color: #009900;">///////////////////////////////// start arrow config \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\</span>
	<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>startStyle == <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		startArrowStyle = <span style="color: #0033ff; font-weight: bold;">new</span> ArrowStyle<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
	<span style="color: #000000;">&#125;</span>
	<span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>startStyle <span style="color: #0033ff; font-weight: bold;">is</span> ArrowStyle<span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		startArrowStyle = startStyle <span style="color: #0033ff; font-weight: bold;">as</span> ArrowStyle;
	<span style="color: #000000;">&#125;</span>
	<span style="color: #0033ff; font-weight: bold;">else</span>
	<span style="color: #000000;">&#123;</span>
		startArrowStyle = <span style="color: #0033ff; font-weight: bold;">new</span> ArrowStyle<span style="color: #000000;">&#40;</span> startStyle <span style="color: #000000;">&#41;</span>;
	<span style="color: #000000;">&#125;</span>
&nbsp;
	vect1 = end.<span style="color: #004993;">subtract</span><span style="color: #000000;">&#40;</span> <span style="color: #004993;">start</span> <span style="color: #000000;">&#41;</span>;
	startHalfWidth = <span style="color: #000000;">&#40;</span>startArrowStyle.headWidth <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">?</span> startArrowStyle.headWidth <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span> <span style="color: #000000; font-weight: bold;">:</span> startArrowStyle.headLength <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span>; 
&nbsp;
	<span style="color: #009900;">//Figure out the line start/end points</span>
	startNorm = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Point</span><span style="color: #000000;">&#40;</span> vect1.<span style="color: #004993;">y</span>, <span style="color: #000000; font-weight: bold;">-</span>vect1.<span style="color: #004993;">x</span> <span style="color: #000000;">&#41;</span>;
	startNorm.<span style="color: #004993;">normalize</span><span style="color: #000000;">&#40;</span> startArrowStyle.shaftThickness<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span> <span style="color: #000000;">&#41;</span>;
	start1 = <span style="color: #004993;">start</span>.<span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span> startNorm <span style="color: #000000;">&#41;</span>;
	start2 = <span style="color: #004993;">start</span>.<span style="color: #004993;">subtract</span><span style="color: #000000;">&#40;</span> startNorm <span style="color: #000000;">&#41;</span>;
	end1 = end.<span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span> startNorm <span style="color: #000000;">&#41;</span>;
	end2 = end.<span style="color: #004993;">subtract</span><span style="color: #000000;">&#40;</span> startNorm <span style="color: #000000;">&#41;</span>;
&nbsp;
	<span style="color: #009900;">//figure out where the arrow head starts</span>
	startHeadPnt = vect1.<span style="color: #004993;">clone</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
	startHeadPnt.<span style="color: #004993;">normalize</span><span style="color: #000000;">&#40;</span> startHeadPnt.<span style="color: #004993;">length</span> <span style="color: #000000; font-weight: bold;">-</span> startArrowStyle.headLength <span style="color: #000000;">&#41;</span>;
	startHeadPnt = startHeadPnt.<span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span> <span style="color: #004993;">start</span> <span style="color: #000000;">&#41;</span>;
&nbsp;
	<span style="color: #009900;">//calculate the arrowhead corners</span>
	startHeadPntNorm = startNorm.<span style="color: #004993;">clone</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
	startHeadPntNorm.<span style="color: #004993;">normalize</span><span style="color: #000000;">&#40;</span> startHalfWidth <span style="color: #000000;">&#41;</span>;
	startEdge1 = startHeadPnt.<span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span> startHeadPntNorm <span style="color: #000000;">&#41;</span>;
	startEdge2 = startHeadPnt.<span style="color: #004993;">subtract</span><span style="color: #000000;">&#40;</span> startHeadPntNorm <span style="color: #000000;">&#41;</span>;
&nbsp;
	<span style="color: #009900;">//Figure out where the arrow connects the the shaft, then calc the intersections</span>
	startShaftCenter = <span style="color: #004993;">Point</span>.<span style="color: #004993;">interpolate</span><span style="color: #000000;">&#40;</span> end, startHeadPnt, startArrowStyle.shaftPosition <span style="color: #000000;">&#41;</span>;
	startInter1 = GeomUtil.getLineIntersection<span style="color: #000000;">&#40;</span> start1, end1, startShaftCenter, startEdge1 <span style="color: #000000;">&#41;</span>;
	startInter2 = GeomUtil.getLineIntersection<span style="color: #000000;">&#40;</span> start2, end2, startShaftCenter, startEdge2 <span style="color: #000000;">&#41;</span>;
&nbsp;
	<span style="color: #009900;">//Figure out the control points</span>
	startEdgeCenter = <span style="color: #004993;">Point</span>.<span style="color: #004993;">interpolate</span><span style="color: #000000;">&#40;</span> end, startHeadPnt, startArrowStyle.edgeControlPosition <span style="color: #000000;">&#41;</span>;
	startEdgeNorm = startNorm.<span style="color: #004993;">clone</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
	startEdgeNorm.<span style="color: #004993;">normalize</span><span style="color: #000000;">&#40;</span> startHalfWidth <span style="color: #000000; font-weight: bold;">*</span> startArrowStyle.edgeControlSize <span style="color: #000000;">&#41;</span>;
	startEdgeCntrl1 = startEdgeCenter.<span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span> startEdgeNorm <span style="color: #000000;">&#41;</span>;
	startEdgeCntrl2 = startEdgeCenter.<span style="color: #004993;">subtract</span><span style="color: #000000;">&#40;</span> startEdgeNorm <span style="color: #000000;">&#41;</span>;
&nbsp;
	<span style="color: #009900;">///////////////////////////////// end arrow config \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\</span>
	<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>endStyle == <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		endArrowStyle = <span style="color: #0033ff; font-weight: bold;">new</span> ArrowStyle<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
	<span style="color: #000000;">&#125;</span>
	<span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>endStyle <span style="color: #0033ff; font-weight: bold;">is</span> ArrowStyle<span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		endArrowStyle = endStyle <span style="color: #0033ff; font-weight: bold;">as</span> ArrowStyle;
	<span style="color: #000000;">&#125;</span>
	<span style="color: #0033ff; font-weight: bold;">else</span>
	<span style="color: #000000;">&#123;</span>
		endArrowStyle = <span style="color: #0033ff; font-weight: bold;">new</span> ArrowStyle<span style="color: #000000;">&#40;</span> endStyle <span style="color: #000000;">&#41;</span>;
	<span style="color: #000000;">&#125;</span>
&nbsp;
	vect2 = <span style="color: #004993;">start</span>.<span style="color: #004993;">subtract</span><span style="color: #000000;">&#40;</span> end <span style="color: #000000;">&#41;</span>;
	endHalfWidth = <span style="color: #000000;">&#40;</span>endArrowStyle.headWidth <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">?</span> endArrowStyle.headWidth <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span> <span style="color: #000000; font-weight: bold;">:</span> endArrowStyle.headLength <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span>;
&nbsp;
	<span style="color: #009900;">//Figure out the line start/end points</span>
	endNorm = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Point</span><span style="color: #000000;">&#40;</span> vect2.<span style="color: #004993;">y</span>, <span style="color: #000000; font-weight: bold;">-</span>vect2.<span style="color: #004993;">x</span> <span style="color: #000000;">&#41;</span>;
	endNorm.<span style="color: #004993;">normalize</span><span style="color: #000000;">&#40;</span> endArrowStyle.shaftThickness <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span> <span style="color: #000000;">&#41;</span>;
	start3 = <span style="color: #004993;">start</span>.<span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span> endNorm <span style="color: #000000;">&#41;</span>;
	start4 = <span style="color: #004993;">start</span>.<span style="color: #004993;">subtract</span><span style="color: #000000;">&#40;</span> endNorm <span style="color: #000000;">&#41;</span>;
	end3 = end.<span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span> endNorm <span style="color: #000000;">&#41;</span>;
	end4 = end.<span style="color: #004993;">subtract</span><span style="color: #000000;">&#40;</span> endNorm <span style="color: #000000;">&#41;</span>;
&nbsp;
	<span style="color: #009900;">//figure out where the arrow head starts</span>
	endHeadPnt = vect2.<span style="color: #004993;">clone</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
	endHeadPnt.<span style="color: #004993;">normalize</span><span style="color: #000000;">&#40;</span> endHeadPnt.<span style="color: #004993;">length</span> <span style="color: #000000; font-weight: bold;">-</span> endArrowStyle.headLength <span style="color: #000000;">&#41;</span>;
	endHeadPnt = endHeadPnt.<span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span> end <span style="color: #000000;">&#41;</span>;
&nbsp;
	<span style="color: #009900;">//calculate the arrowhead corners</span>
	endHeadPntNorm = endNorm.<span style="color: #004993;">clone</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
	endHeadPntNorm.<span style="color: #004993;">normalize</span><span style="color: #000000;">&#40;</span> endHalfWidth <span style="color: #000000;">&#41;</span>;
	endEdge1 = endHeadPnt.<span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span> endHeadPntNorm <span style="color: #000000;">&#41;</span>;
	endEdge2 = endHeadPnt.<span style="color: #004993;">subtract</span><span style="color: #000000;">&#40;</span> endHeadPntNorm <span style="color: #000000;">&#41;</span>;
&nbsp;
	<span style="color: #009900;">//Figure out where the arrow connects the the shaft, then calc the intersections</span>
	endShaftCenter = <span style="color: #004993;">Point</span>.<span style="color: #004993;">interpolate</span><span style="color: #000000;">&#40;</span> <span style="color: #004993;">start</span>, endHeadPnt, endArrowStyle.shaftPosition <span style="color: #000000;">&#41;</span>;
	endInter1 = GeomUtil.getLineIntersection<span style="color: #000000;">&#40;</span> end3, start3, endShaftCenter, endEdge1 <span style="color: #000000;">&#41;</span>;
	endInter2 = GeomUtil.getLineIntersection<span style="color: #000000;">&#40;</span> end4, start4, endShaftCenter, endEdge2 <span style="color: #000000;">&#41;</span>;
&nbsp;
	<span style="color: #009900;">//Figure out the control points</span>
	endEdgeCenter = <span style="color: #004993;">Point</span>.<span style="color: #004993;">interpolate</span><span style="color: #000000;">&#40;</span> <span style="color: #004993;">start</span>, endHeadPnt, endArrowStyle.edgeControlPosition <span style="color: #000000;">&#41;</span>;
	endEdgeNorm = endNorm.<span style="color: #004993;">clone</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
	endEdgeNorm.<span style="color: #004993;">normalize</span><span style="color: #000000;">&#40;</span> endHalfWidth <span style="color: #000000; font-weight: bold;">*</span> endArrowStyle.edgeControlSize <span style="color: #000000;">&#41;</span>;
	endEdgeCntrl1 = endEdgeCenter.<span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span> endEdgeNorm <span style="color: #000000;">&#41;</span>;
	endEdgeCntrl2 = endEdgeCenter.<span style="color: #004993;">subtract</span><span style="color: #000000;">&#40;</span> endEdgeNorm <span style="color: #000000;">&#41;</span>;
&nbsp;
	<span style="color: #009900;">///////////////////////////////// draw the graphics \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\</span>
	<span style="color: #009900;">// draw 1st arrow</span>
	<span style="color: #004993;">graphics</span>.<span style="color: #004993;">moveTo</span><span style="color: #000000;">&#40;</span> start1.<span style="color: #004993;">x</span>, start2.<span style="color: #004993;">y</span> <span style="color: #000000;">&#41;</span>;
	<span style="color: #004993;">graphics</span>.<span style="color: #004993;">lineTo</span><span style="color: #000000;">&#40;</span> startInter1.<span style="color: #004993;">x</span>, startInter1.<span style="color: #004993;">y</span> <span style="color: #000000;">&#41;</span>;
	<span style="color: #004993;">graphics</span>.<span style="color: #004993;">lineTo</span><span style="color: #000000;">&#40;</span> startEdge1.<span style="color: #004993;">x</span>, startEdge1.<span style="color: #004993;">y</span> <span style="color: #000000;">&#41;</span>;
	<span style="color: #004993;">graphics</span>.<span style="color: #004993;">curveTo</span><span style="color: #000000;">&#40;</span> startEdgeCntrl1.<span style="color: #004993;">x</span>, startEdgeCntrl1.<span style="color: #004993;">y</span>, end.<span style="color: #004993;">x</span>, end.<span style="color: #004993;">y</span> <span style="color: #000000;">&#41;</span>;
	<span style="color: #004993;">graphics</span>.<span style="color: #004993;">curveTo</span><span style="color: #000000;">&#40;</span> startEdgeCntrl2.<span style="color: #004993;">x</span>, startEdgeCntrl2.<span style="color: #004993;">y</span>, startEdge2.<span style="color: #004993;">x</span>, startEdge2.<span style="color: #004993;">y</span> <span style="color: #000000;">&#41;</span>;
	<span style="color: #004993;">graphics</span>.<span style="color: #004993;">lineTo</span><span style="color: #000000;">&#40;</span> startInter2.<span style="color: #004993;">x</span>, startInter2.<span style="color: #004993;">y</span> <span style="color: #000000;">&#41;</span>;
	<span style="color: #004993;">graphics</span>.<span style="color: #004993;">lineTo</span><span style="color: #000000;">&#40;</span> start2.<span style="color: #004993;">x</span>, start2.<span style="color: #004993;">y</span> <span style="color: #000000;">&#41;</span>;
	<span style="color: #004993;">graphics</span>.<span style="color: #004993;">lineTo</span><span style="color: #000000;">&#40;</span> start1.<span style="color: #004993;">x</span>, start1.<span style="color: #004993;">y</span> <span style="color: #000000;">&#41;</span>;
&nbsp;
	<span style="color: #009900;">// draw 2nd arrow</span>
	<span style="color: #004993;">graphics</span>.<span style="color: #004993;">moveTo</span><span style="color: #000000;">&#40;</span> end3.<span style="color: #004993;">x</span>, end4.<span style="color: #004993;">y</span> <span style="color: #000000;">&#41;</span>;
	<span style="color: #004993;">graphics</span>.<span style="color: #004993;">lineTo</span><span style="color: #000000;">&#40;</span> endInter1.<span style="color: #004993;">x</span>, endInter1.<span style="color: #004993;">y</span> <span style="color: #000000;">&#41;</span>;
	<span style="color: #004993;">graphics</span>.<span style="color: #004993;">lineTo</span><span style="color: #000000;">&#40;</span> endEdge1.<span style="color: #004993;">x</span>, endEdge1.<span style="color: #004993;">y</span> <span style="color: #000000;">&#41;</span>;
	<span style="color: #004993;">graphics</span>.<span style="color: #004993;">curveTo</span><span style="color: #000000;">&#40;</span> endEdgeCntrl1.<span style="color: #004993;">x</span>, endEdgeCntrl1.<span style="color: #004993;">y</span>, <span style="color: #004993;">start</span>.<span style="color: #004993;">x</span>, <span style="color: #004993;">start</span>.<span style="color: #004993;">y</span> <span style="color: #000000;">&#41;</span>;
	<span style="color: #004993;">graphics</span>.<span style="color: #004993;">curveTo</span><span style="color: #000000;">&#40;</span> endEdgeCntrl2.<span style="color: #004993;">x</span>, endEdgeCntrl2.<span style="color: #004993;">y</span>, endEdge2.<span style="color: #004993;">x</span>, endEdge2.<span style="color: #004993;">y</span> <span style="color: #000000;">&#41;</span>;
	<span style="color: #004993;">graphics</span>.<span style="color: #004993;">lineTo</span><span style="color: #000000;">&#40;</span> endInter2.<span style="color: #004993;">x</span>, endInter2.<span style="color: #004993;">y</span> <span style="color: #000000;">&#41;</span>;
	<span style="color: #004993;">graphics</span>.<span style="color: #004993;">lineTo</span><span style="color: #000000;">&#40;</span> end4.<span style="color: #004993;">x</span>, end4.<span style="color: #004993;">y</span> <span style="color: #000000;">&#41;</span>;
	<span style="color: #004993;">graphics</span>.<span style="color: #004993;">lineTo</span><span style="color: #000000;">&#40;</span> end3.<span style="color: #004993;">x</span>, end3.<span style="color: #004993;">y</span> <span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Those are the basics. It can be tweaked to taste, etc. Kudos to Noel for such a useful class&#8230; <img src='http://technophi.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://technophi.com/2009/12/07/double-headed-arrows-with-graphicsutil/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Overlaying the Flex SDK with the AIR 2.0 SDK on OSX</title>
		<link>http://technophi.com/2009/12/04/overlaying-the-flex-sdk-with-the-air-2-0-sdk-on-osx/</link>
		<comments>http://technophi.com/2009/12/04/overlaying-the-flex-sdk-with-the-air-2-0-sdk-on-osx/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 15:55:36 +0000</pubDate>
		<dc:creator>Hasan Otuome</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://technophi.com/?p=300</guid>
		<description><![CDATA[Since I develop with multiple IDEs, I maintain the latest releases of the Flex and AIR SDKs in a centralized location outside of their default install locations. This made enabling the AIR 2.0 SDK simple for me as all I had to do was the following: 1. Duplicate my Flex 3 SDK path 2. Rename [...]]]></description>
			<content:encoded><![CDATA[<p>Since I develop with multiple IDEs, I maintain the latest releases of the Flex and AIR SDKs in a centralized location outside of their default install locations. This made enabling the AIR 2.0 SDK simple for me as all I had to do was the following:</p>
<p>1. Duplicate my Flex 3 SDK path<br />
2. Rename the duplicate to <strong>flex_sdk_3.x_air_sdk_2.x</strong><br />
3. Download the latest AIR 2.0 SDK (currently <strong>AIR20_mac_sdk_120209.tbz2</strong>)<br />
4. Place the AIR SDK zip in the root of the new Flex SDK directory</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>flex_sdk_3.x_air_sdk_2.x<span style="color: #000000; font-weight: bold;">/</span>AIR20_mac_sdk_120209.tbz2</pre></div></div>

<p>5. Open up Terminal in the new Flex SDK directory and execute the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xjf</span> AIR20_mac_sdk_120209.tbz2</pre></div></div>

<p>6. Open Flex Builder and add the new SDK -> <strong>Flex Builder > Preferences > Installed Flex SDKs > Add</strong></p>
<p>Now, when I want to create an AIR app that targets the 2.0 SDK all I have to do is</p>
<p>1. Update the project compiler settings to use the new SDK -> <strong>Project > Properties > Flex Compiler > Use a Specific SDK</strong><br />
2. Update the application descriptor file to use the AIR 2.0 namespace</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;application</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://ns.adobe.com/air/application/2.0beta&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></pre></div></div>

<p>All of the above steps can be repeated for the Flex 4 SDK as well.</p>
<p>For those interested, these are the items that were updated and added to the SDK for 2.0:<br />
<em>/bin/adl<br />
/bin/adt<br />
/frameworks/libs/air<br />
/frameworks/projects/air<br />
/lib/nai<br />
/lib/adt.jar<br />
/runtimes/air<br />
/samples<br />
/templates/air<br />
/AIR SDK Readme.txt<br />
/SDK license.pdf</em></p>
<p><strong>CAVEATS:</strong></p>
<ol>
<li>There&#8217;s a <a href="http://blogs.adobe.com/simplicity/2009/11/upcoming_certificate_renewal_c.html">new certificate process started in AIR 1.5.3</a> that may disrupt your workflow if you&#8217;re creating signed applications.</li>
<li>If you want to utilize the new native process features, you&#8217;ll have to implement multi-platform builds (native installers for Win, Mac and Linux) and these must occur on the target platform (ie, can only create DMGs on Mac, etc)</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://technophi.com/2009/12/04/overlaying-the-flex-sdk-with-the-air-2-0-sdk-on-osx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ZamfBrowser &#8211; ZendAMF Service Browser</title>
		<link>http://technophi.com/2009/11/13/zamfbrowser-zendamf-service-browser/</link>
		<comments>http://technophi.com/2009/11/13/zamfbrowser-zendamf-service-browser/#comments</comments>
		<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate>
		<dc:creator>Hasan Otuome</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[OSX Server]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[ZendAmf]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[<a href="http://www.zamfbrowser.org"><img src="http://www.zamfbrowser.org/images/zamfbrowser.png"/></a>
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.zamfbrowser.org"><img src="http://www.zamfbrowser.org/images/zamfbrowser.png"/></a></p>
<p>One of my colleagues at <a href="http://almerblank.com"><b>Almer/Blank</b></a>, Omar Gonzalez, just released a very promising project into the open source community today, <a href="http://www.zamfbrowser.org/"><b>ZamfBrowser</b></a>. This AIR application is a lifeline for all the developers who have embraced <a href="http://framework.zend.com/manual/en/zend.amf.html"><b>ZendAMF</b></a> since its release yet have longed for that familiar service browser paradigm we grew used to with AMFPHP. Well, wait no longer. ZamfBrowser performs server introspection to give you access to your ZendAMF services and it even features test retention by remembering the last arguments used for method testing between sessions. This is definitely an application worth a look if you plan on doing any AMF development.</p>
]]></content:encoded>
			<wfw:commentRss>http://technophi.com/2009/11/13/zamfbrowser-zendamf-service-browser/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Using the Flex IViewCursor to Manage an ArrayCollection</title>
		<link>http://technophi.com/2009/11/12/using-iviewcursor-to-manage-an-arraycollection/</link>
		<comments>http://technophi.com/2009/11/12/using-iviewcursor-to-manage-an-arraycollection/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 15:12:45 +0000</pubDate>
		<dc:creator>Hasan Otuome</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[OSX]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[One of the nice things about the Flex framework is the various utility classes that make it so much easier for you to accomplish your development tasks than you'd be able to without them. One such class, in my opinion, is <a href="http://livedocs.adobe.com/flex/3/langref/mx/collections/IViewCursor.html" target="blank"><b>mx.collections.IViewCursor</b></a>.]]></description>
			<content:encoded><![CDATA[<p>One of the nice things about the Flex framework is the various utility classes that make it so much easier for you to accomplish your development tasks than you&#8217;d be able to without them. One such class, in my opinion, is <a href="http://livedocs.adobe.com/flex/3/langref/mx/collections/IViewCursor.html" target="blank"><strong>mx.collections.IViewCursor</strong></a>. What this class does is to define an interface for enumerating a collection view (ie, <a href="http://livedocs.adobe.com/flex/3/langref/mx/collections/ArrayCollection.html" target="blank"><strong>ArrayCollection</strong></a>) both forwards and backwards. Using this construct, you can avoid having to use for.. loops to examine the collection.</p>
<p>Here&#8217;s a quick example of a fictitious auto maker that&#8217;s tasked us to update some info related to one of its auto dealers after receiving the quarterly sales report:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> carDealers<span style="color: #000000; font-weight: bold;">:</span>ArrayCollection;
<span style="color: #6699cc; font-weight: bold;">var</span> dealerCursor<span style="color: #000000; font-weight: bold;">:</span>IViewCursor;
<span style="color: #6699cc; font-weight: bold;">var</span> vehicleCursor<span style="color: #000000; font-weight: bold;">:</span>IViewCursor;
&nbsp;
<span style="color: #6699cc; font-weight: bold;">var</span> affectedDealer<span style="color: #000000; font-weight: bold;">:</span>CarDealer;
<span style="color: #6699cc; font-weight: bold;">var</span> targetVehicle<span style="color: #000000; font-weight: bold;">:</span>Car;
<span style="color: #6699cc; font-weight: bold;">var</span> targetVehicleIndex<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>;
&nbsp;
<span style="color: #6699cc; font-weight: bold;">var</span> dealerIdFromSale<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">'XXXXXXXX-XXXX-XXXX-XXXXXXXXXXX'</span>;
<span style="color: #6699cc; font-weight: bold;">var</span> vinNumberFromSale<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">'XXXXXXXXXXXXXXXXX'</span>;
&nbsp;
dealerCursor = carDealers.createCursor<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #009900;">// iterate through the list of dealers</span>
<span style="color: #0033ff; font-weight: bold;">while</span> <span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight: bold;">!</span>dealerCursor.afterLast<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
  <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>dealerCursor.current.dealerId == dealerIdFromSale<span style="color: #000000;">&#41;</span>
  <span style="color: #000000;">&#123;</span>
     affectedDealer = CarDealer<span style="color: #000000;">&#40;</span> dealerCursor.current <span style="color: #000000;">&#41;</span>;
&nbsp;
     <span style="color: #009900;">// create a cursor to iterate over the dealer's inventory</span>
     vehicleCursor = affectedDealer.inventory.createCursor<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
     <span style="color: #009900;">// iterate over the inventory</span>
     <span style="color: #0033ff; font-weight: bold;">while</span> <span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight: bold;">!</span>vehicleCursor.afterLast<span style="color: #000000;">&#41;</span>
     <span style="color: #000000;">&#123;</span>
        <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>vehicleCursor.current.VIN == vinNumberFromSale<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
           <span style="color: #009900;">// a match was found so now we need the</span>
           <span style="color: #009900;">// index of this vehicle in the ArrayCollection</span>
           targetVehicle = Car<span style="color: #000000;">&#40;</span> vehicleCursor.current <span style="color: #000000;">&#41;</span>;
           targetVehicleIndex = affectedDealer.inventory.getItemIndex<span style="color: #000000;">&#40;</span> targetVehicle <span style="color: #000000;">&#41;</span>;
&nbsp;
           <span style="color: #009900;">// since the sale was successful, we can safely</span>
           <span style="color: #009900;">// remove the vehicle from this dealer's inventory</span>
           affectedDealer.inventory.removeItemAt<span style="color: #000000;">&#40;</span> targetVehicleIndex <span style="color: #000000;">&#41;</span>;
        <span style="color: #000000;">&#125;</span>
&nbsp;
        vehicleCursor.moveNext<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
     <span style="color: #000000;">&#125;</span>
  <span style="color: #000000;">&#125;</span>
&nbsp;
  dealerCursor.moveNext<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>In a few lines of code, we&#8217;re able to create some very readable and manageable logic to complete the task of updating the inventory. And, you may notice that we also iterated over not one, but two <a href="http://livedocs.adobe.com/flex/3/langref/mx/collections/ArrayCollection.html" target="blank"><strong>ArrayCollection</strong></a> instances with our mighty <a href="http://livedocs.adobe.com/flex/3/langref/mx/collections/IViewCursor.html" target="blank"><strong>IViewCursor</strong></a>. One additional thing to note is the use of the <strong>moveNext()</strong> method. It&#8217;s important that you instruct the cursor that it&#8217;s OK to advance even though you&#8217;ve found what you&#8217;re looking for; otherwise, plan on some serious hang time. I mean it is still a while..loop after all!</p>
<p> <img src='http://technophi.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://technophi.com/2009/11/12/using-iviewcursor-to-manage-an-arraycollection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
