<?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>Kerkness.ca &#187; Actionscript</title>
	<atom:link href="http://www.kerkness.ca/content/actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kerkness.ca</link>
	<description>flexing my kerkness, among other things</description>
	<lastBuildDate>Wed, 14 Oct 2009 15:12:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.3</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How To Launch an Adobe Air WindowedApplication in Full Screen Mode</title>
		<link>http://www.kerkness.ca/how-to-launch-an-adobe-air-windowedapplication-in-full-screen-mode/</link>
		<comments>http://www.kerkness.ca/how-to-launch-an-adobe-air-windowedapplication-in-full-screen-mode/#comments</comments>
		<pubDate>Sat, 28 Mar 2009 03:23:35 +0000</pubDate>
		<dc:creator>Kerk</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[adobe air]]></category>
		<category><![CDATA[mxml]]></category>
		<category><![CDATA[windowedapplication]]></category>

		<guid isPermaLink="false">http://www.kerkness.ca/?p=408</guid>
		<description><![CDATA[Here is a basic Adobe Air WindowedApplication set up to launch in full screen mode.

&#60;?xml version="1.0" encoding="utf-8"?&#62;
&#60;mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="init()"&#62;

&#60;mx:Script&#62;
	&#60;![CDATA[

private function init():void
{
	systemManager.stage.displayState=flash.display.StageDisplayState.FULL_SCREEN_INTERACTIVE
}
	]]&#62;
&#60;/mx:Script&#62;

&#60;/mx:WindowedApplication&#62;

]]></description>
			<content:encoded><![CDATA[<p>Here is a basic Adobe Air WindowedApplication set up to launch in full screen mode.</p>
<pre>
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="init()"&gt;

&lt;mx:Script&gt;
	&lt;![CDATA[

private function init():void
{
	systemManager.stage.displayState=flash.display.StageDisplayState.FULL_SCREEN_INTERACTIVE
}
	]]&gt;
&lt;/mx:Script&gt;

&lt;/mx:WindowedApplication&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.kerkness.ca/how-to-launch-an-adobe-air-windowedapplication-in-full-screen-mode/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Monitor your flash log when debugging Flex or Air Application on OSX</title>
		<link>http://www.kerkness.ca/monitor-your-flash-log-when-debugging-flex-or-air-application-on-osx/</link>
		<comments>http://www.kerkness.ca/monitor-your-flash-log-when-debugging-flex-or-air-application-on-osx/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 20:37:41 +0000</pubDate>
		<dc:creator>Kerk</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[adobe air]]></category>
		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://www.kerkness.ca/?p=404</guid>
		<description><![CDATA[When building and debugging a Flex or Air application it can be a big help if you&#8217;re able to monitor the progress the application makes through your various classes and views.  A great way to do this is to add trace(&#8221;I am here&#8221;) function calls to your code and then monitor the flash log [...]]]></description>
			<content:encoded><![CDATA[<p>When building and debugging a Flex or Air application it can be a big help if you&#8217;re able to monitor the progress the application makes through your various classes and views.  A great way to do this is to add <strong><em>trace(&#8221;I am here&#8221;)</em></strong> function calls to your code and then monitor the flash log file when running the application.</p>
<ol>
<li>Make sure you have the debugger version of the flash player installed</li>
<li>Add  trace(&#8221;your test message or details&#8221;);  to your code where appropriate</li>
<li>Open Applications/Utilities/Terminal</li>
<li>Go to the location of the Flash log file..<br />
<strong><em>/Users/[username]/Library/Preferences/[App Name]/Local Store/<br />
</em></strong></li>
<li>Type the following command<br />
<strong><em>tail -f flashlog.txt<br />
</em></strong></li>
<li>Launch your application.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.kerkness.ca/monitor-your-flash-log-when-debugging-flex-or-air-application-on-osx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting minHeight/minWidth on Adobe Air app forces ViewStack creationPolicy to ALL : or at least I think so.</title>
		<link>http://www.kerkness.ca/setting-minheightminwidth-on-adobe-air-app-forces-viewstack-creationpolicy-to-all-or-at-least-i-think-so/</link>
		<comments>http://www.kerkness.ca/setting-minheightminwidth-on-adobe-air-app-forces-viewstack-creationpolicy-to-all-or-at-least-i-think-so/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 15:26:53 +0000</pubDate>
		<dc:creator>Kerk</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[adobe air]]></category>
		<category><![CDATA[creationPolicy]]></category>

		<guid isPermaLink="false">http://www.kerkness.ca/?p=400</guid>
		<description><![CDATA[I guess it&#8217;s been a real busy couple of months for me as I haven&#8217;t managed to post anything since December.  Here is a little gotcha that I ran across while converting a Flex App to an Adobe Air app.
In my application and the main WindowedApplication contains a ViewStack and a ViewController. Inside the [...]]]></description>
			<content:encoded><![CDATA[<p>I guess it&#8217;s been a real busy couple of months for me as I haven&#8217;t managed to post anything since December.  Here is a little gotcha that I ran across while converting a Flex App to an Adobe Air app.</p>
<p>In my application and the main WindowedApplication contains a ViewStack and a ViewController. Inside the ViewStack are the various MXML views which make up the application.  When my application was just a Flex app I sized the application to 100% width/height in the html-template file.  However for my Air application it is necessary to set a minimum width/height on launch and let the user decide if they want to maximize the window or set a custom size.</p>
<p>The gotcha came when I set minWidth and minHeight on the new WindowedApplication. This apparently sets the creationPolicy to &#8216; ALL &#8216; on the parent and thus is inherited by the ViewStack.</p>
<blockquote><p>If no creationPolicy is specified for a container, that container inherits its parent&#8217;s creationPolicy. If no creationPolicy is specified for the Application, it defaults to ContainerCreationPolicy.AUTO.</p></blockquote>
<p>So the moral of this story is.  If you set minHeight/minWidth on a WindowedApplication consider the desired creationPolicy for children. If you don&#8217;t want all children to be automatically created when the application is launched then you&#8217;ll need to adjust the creationPolicy for child containers manually to &#8216; auto &#8216; or &#8216; none &#8216;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kerkness.ca/setting-minheightminwidth-on-adobe-air-app-forces-viewstack-creationpolicy-to-all-or-at-least-i-think-so/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP and Flex with Kerkness and Claire</title>
		<link>http://www.kerkness.ca/php-and-flex-with-kerkness-and-claire/</link>
		<comments>http://www.kerkness.ca/php-and-flex-with-kerkness-and-claire/#comments</comments>
		<pubDate>Wed, 17 Dec 2008 05:24:38 +0000</pubDate>
		<dc:creator>Kerk</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[claire]]></category>
		<category><![CDATA[kerkness]]></category>

		<guid isPermaLink="false">http://www.kerkness.ca/?p=311</guid>
		<description><![CDATA[The following example shows a simple Flex application using Claire that communicates with a PHP server running Kerkness.
Click here to view the demo application
Click here to view the demo source
The demo application starts out by displaying a form which has 2 input fields.  When submitted the value of the form is submitted to the PHP [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows a simple Flex application using <a href="http://www.kerkness.ca/?page_id=97">Claire</a> that communicates with a PHP server running <a href="http://www.kerkness.ca/?page_id=95">Kerkness</a>.</p>
<p><a href="http://kerkness.ca/flexexamples/ClaireKerkness/ClaireKerkness.html">Click here to view the demo application</a></p>
<p><a href="http://kerkness.ca/flexexamples/ClaireKerkness/srcview/index.html">Click here to view the demo source</a></p>
<p>The demo application starts out by displaying a form which has 2 input fields.  When submitted the value of the form is submitted to the PHP service which validates the submission and returns a response.  If there are no errors the results are displayed.</p>
<h3>ClaireKerkness.mxml</h3>
<p>The main application MXML file contains the ViewController and a ViewStack with both our FormView and ResultView as children. When the view controller dispatches the mainViewChange event a handler function changes the displayed view.</p>
<h3>model/Views.as</h3>
<p>This is a very simple Actionscript class which defines a couple of static constants to use as the names for our two views.</p>
<h3>model/NameModel.as</h3>
<p>A simple Actionscript class which we use as a data model.  When a response is returned we update this model.</p>
<blockquote><p>NOTE: In this example our NameModel is a Singleton Class because we only want one instance.  This doesn&#8217;t have to be the case. You might want to create many instances of a data model if you expect many records of similar data.</p></blockquote>
<h3>views/FormView.mxml</h3>
<p>FormView is an MXML component that contains a couple of form elements and a ClaireService component which is used to send a HTTPService request to the Kerkness backend. If an error is returned the error message is displayed.  If a response is returned we update the NameModel and change the currentView to our ResultView.</p>
<h3>views/ResultView.mxml</h3>
<p>ResultView is a simple MXML component which displays content from the NameModel.</p>
<h3>kerk/module/demo/submitform.php</h3>
<p>This is the PHP file which accepts our form submission. Check out the kerkness tutorials for details on how the <a href="http://www.kerkness.ca/?page_id=95">kerkness</a> framework handles requests.</p>
<p>PHP Source Code</p>
<pre name="code" class="php">

if( ! $_POST['firstname'] || ! $_POST['lastname'] )
{
 	$kerk->throwError('Incomplete Submission...', true );
}

$fullName = $_POST['firstname']. ' ' .$_POST['lastname'];

$kerk->addContent('fullName', $fullName); 
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.kerkness.ca/php-and-flex-with-kerkness-and-claire/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating an ItemRenderer in ActionScript</title>
		<link>http://www.kerkness.ca/creating-an-itemrenderer-in-actionscript/</link>
		<comments>http://www.kerkness.ca/creating-an-itemrenderer-in-actionscript/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 21:17:00 +0000</pubDate>
		<dc:creator>Kerk</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://www.kerkness.ca/blog/?p=64</guid>
		<description><![CDATA[I&#8217;m posting this for my benefit as much as anyone else. Here is a very basic ItemRenderer done in ActionScript.  Something you might come across when building Flex/Air applications is errand problems with ItemRenderer&#8217;s not performing as expected, sucking up lots of memory, or throwing errors.  Many times these problems can be solved [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m posting this for my benefit as much as anyone else. Here is a very basic ItemRenderer done in ActionScript.  Something you might come across when building Flex/Air applications is errand problems with ItemRenderer&#8217;s not performing as expected, sucking up lots of memory, or throwing errors.  Many times these problems can be solved by building your renderer in ActionScript.  Here is the source for a basic item renderer which can be scaled up as needed.</p>
<pre name="code" class="javascript">package my.renderer
{
 import my.model.DataModel;

 import mx.controls.Label;
 import mx.controls.listClasses.IListItemRenderer;
 import mx.controls.listClasses.ListBase;
 import mx.core.UIComponent;

 public class ArtListRenderer extends UIComponent implements IListItemRenderer
 {
  public function ArtListRenderer()
  {
   super();
  }

     [Bindable] public var myData:DataModel = new DataModel();

     // Internal variable for the property value.
     private var _data:Object;

     // Make the data property bindable.
     [Bindable("dataChange")]

     // Define the getter method.
     public function get data():Object {
         return _data;
     }

     // Define the setter method, and dispatch an event when the property
     // changes to support data binding.
     public function set data(value:Object):void {
         _data = value;

         myData = new DataModel();
         myData.firstname = value.firstname;
         myData.lastname = value.lastname;

         invalidateProperties();
         dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
     }

     private var hBox:HBox;
     private var firstnameLabel:Label;
     private var lastnameLabel:Label;

     override protected function createChildren():void
     {
      super.createChildren();

      hBox = new HBox();

      firstnameLabel = new Label();
      lastnameLabel = new Label();
      hBox.addChild( firstnameLabel );
      hBox.addChild( lastnameLabel );

     }  

     override protected function commitProperties():void
     {
      super.commitProperties();

      hBox.horizontalScrollPolicy = 'off';
      hBox.verticalScrollPolicy = 'off';

      hBox.percentWidth = 100;

      firstnameLabel.text = myData.firstname;
      lastnameLabel.text = myData.lastname;
     }

     override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
     {
      super.updateDisplayList(unscaledWidth,unscaledHeight);
      hBox.move(0,0);
      hBox.setActualSize( (unscaledWidth-4), unscaledHeight);
     }
 }
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.kerkness.ca/creating-an-itemrenderer-in-actionscript/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Force creation of complete ViewStack with creationPolicy when building a form across multiple views : Flex Tip</title>
		<link>http://www.kerkness.ca/force-creation-of-complete-viewstack-with-creationpolicy-when-building-a-form-across-multiple-views-flex-tip/</link>
		<comments>http://www.kerkness.ca/force-creation-of-complete-viewstack-with-creationpolicy-when-building-a-form-across-multiple-views-flex-tip/#comments</comments>
		<pubDate>Fri, 03 Oct 2008 21:23:00 +0000</pubDate>
		<dc:creator>Kerk</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://www.kerkness.ca/blog/?p=60</guid>
		<description><![CDATA[Here&#8217;s a tip which might be useful for some people.&#160; Sometimes when building a Flex/Adobe Air interface you may want to have form elements which are built across multiple views of a ViewStack, or TabNavigator.&#160; For example I have a contact form which has some rarely used fields contained in a secondary Tab in my [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a tip which might be useful for some people.&nbsp; Sometimes when building a Flex/Adobe Air interface you may want to have form elements which are built across multiple views of a <i>ViewStack</i>, or <i>TabNavigator</i>.&nbsp; For example I have a contact form which has some rarely used fields contained in a secondary Tab in my form.</p>
<p>Problem with this approach is that the default value of a Container&#8217;s <i><b>creationPolicy</b></i> is &#8216;<i>auto</i>&#8216;.&nbsp; This means child components are only created when they are needed.&nbsp; If your user never looks at the extra tabs/view stack layers then these form elements are not available if you need to get values or set values for them.</p>
<p>The Solution is to simple set the <b><i>creationPolicy</i></b> for your <i>ViewStack</i> or <i>TabNavigator</i> to &#8216;<i>all</i>&#8216;.&nbsp; This will ensure that all child elements are created up front and are available when needed regardless if the user looks at them or not.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kerkness.ca/force-creation-of-complete-viewstack-with-creationpolicy-when-building-a-form-across-multiple-views-flex-tip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex Tip : Use ObjectUtil for Alpha and Numeric sorting on a DataGrid</title>
		<link>http://www.kerkness.ca/flex-tip-use-objectutil-for-alpha-and-numeric-sorting-on-a-datagrid/</link>
		<comments>http://www.kerkness.ca/flex-tip-use-objectutil-for-alpha-and-numeric-sorting-on-a-datagrid/#comments</comments>
		<pubDate>Thu, 02 Oct 2008 20:13:00 +0000</pubDate>
		<dc:creator>Kerk</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://www.kerkness.ca/blog/?p=59</guid>
		<description><![CDATA[If you haven&#8217;t taken the time to look at the features of Flex&#8217;s ObjectUtil you should. Inside are a few handy methods which I see getting over looked.
Two of those methods are ObjectUtil.stringCompare and ObjectUtil.numericCompare. These methods make it simple to provide intelegent sorting on DataGrid columns.
Let&#8217;s say you have a DataGrid that has one [...]]]></description>
			<content:encoded><![CDATA[<p>If you haven&#8217;t taken the time to look at the features of Flex&#8217;s <i>ObjectUtil</i> you should. Inside are a few handy methods which I see getting over looked.</p>
<p>Two of those methods are <i>ObjectUtil</i>.<i>stringCompare</i> and <i>ObjectUtil</i>.<i>numericCompare</i>. These methods make it simple to provide intelegent sorting on <i>DataGrid</i> columns.</p>
<p>Let&#8217;s say you have a <i>DataGrid</i> that has one column full of ID# and another column full of people&#8217;s names including both first and last names. Chances are the default sorting abilities of the <i>DataGrid</i> will not properly sort either column. The ID# would be sorted 1,10,11,12&#8230; instead of 1,2,3,4,5&#8230; and the column of names would sort by the first name and not the last name.</p>
<p>Lucky the <i>DataGridColumn</i> allows you to set a custom sort function via the property <i>sortCompareFunction</i>. For example look at these two <i>DataGridColumns</i>.</p>
<pre>&lt;mx:DataGridColumn headerText="ID#" dataField="contactid" sortCompareFunction="sortContactId"/&gt;
&lt;mx:DataGridColumn headerText="Name" dataField="full_name" sortCompareFunction="sortLastName"&gt;
 &lt;mx:itemRenderer&gt;
  &lt;mx:Component&gt;
    &lt;mx:Label paddingLeft="5" text="{data.firstname} {data.lastname}" /&gt;
  &lt;/mx:Component&gt;
 &lt;/mx:itemRenderer&gt;
&lt;/mx:DataGridGolumn&gt;
</pre>
<p>
The first column is for the ID# of a contact, the second column uses an <i>itemRenderer</i> and displays both the <i>firstname</i> and <i>lastname</i> for the contact. Each column defines it&#8217;s own <i>sortCompareFunction</i>. Both functions make use of methods from <i>mx.utils.ObjectUtil</i>.</p>
<pre>private function sortLastName(obj1:Object,obj2:Object):int
{
   var value1:String = (obj1.lastname == '' || obj1.lastname == null) ? null : new String(obj1.lastname);
   var value2:String = (obj2.lastname == '' || obj2.lastname == null) ? null : new String(obj2.lastname);
   return ObjectUtil.stringCompare( value1, value2, true );
}
private function sortContactId(obj1:Object,obj2:Object):int
{
   var value1:Number = (obj1.contactid == '' || obj1.contactid == null) ? null : new Number(obj1.contactid);
   var value2:Number = (obj2.contactid == '' || obj2.contactid == null) ? null : new Number(obj2.contactid);
   return ObjectUtil.numericCompare( value1, value2 );
}
</pre>
<p>
These functions are pretty straight forward.&nbsp; <i>sortLastName</i> function uses <i>stringCompare</i> method to compare the <i>lastname</i> from two objects. The flag &#8216;true&#8217; is set to make sure that the comparison is case insensitive. The <i>sortContactId</i> function uses the <i>numericCompare</i> method to compare the <i>contactid</i> from two objects.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kerkness.ca/flex-tip-use-objectutil-for-alpha-and-numeric-sorting-on-a-datagrid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex Tip: ArrayCollection replace an item with setItemAt</title>
		<link>http://www.kerkness.ca/flex-tip-arraycollection-replace-an-item-with-setitemat/</link>
		<comments>http://www.kerkness.ca/flex-tip-arraycollection-replace-an-item-with-setitemat/#comments</comments>
		<pubDate>Thu, 02 Oct 2008 02:55:00 +0000</pubDate>
		<dc:creator>Kerk</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://www.kerkness.ca/blog/?p=57</guid>
		<description><![CDATA[One thing which might not be clear when working with ArrayCollections in Flex is how to replace an item in the collection.&#160; The methods getItemAt and addItemAt are pretty clear in their purpose, but one method which I found myself over looking is the setItemAt method which could be more aptly named replaceItemAt as that [...]]]></description>
			<content:encoded><![CDATA[<p>One thing which might not be clear when working with <i>ArrayCollections</i> in Flex is how to replace an item in the collection.&nbsp; The methods <i>getItemAt</i> and <i>addItemAt</i> are pretty clear in their purpose, but one method which I found myself over looking is the <i>setItemAt</i> method which could be more aptly named <i>replaceItemAt</i> as that is exactly what it does.&nbsp; It replaces an item in the collection.</p>
<p>So next time you&#8217;re looking to replace an item in an <i>ArrayCollection</i> and wishing there was a <i>replaceItemAt</i> method, look no further than <a href="http://livedocs.adobe.com/flex/201/langref/mx/collections/ListCollectionView.html#setItemAt%28%29">setItemAt</a>.&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kerkness.ca/flex-tip-arraycollection-replace-an-item-with-setitemat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex Component : Yet Another Flex File Upload Component</title>
		<link>http://www.kerkness.ca/flex-component-yet-another-flex-file-upload-component/</link>
		<comments>http://www.kerkness.ca/flex-component-yet-another-flex-file-upload-component/#comments</comments>
		<pubDate>Fri, 27 Jun 2008 02:42:00 +0000</pubDate>
		<dc:creator>Kerk</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Components]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://www.kerkness.ca/blog/?p=50</guid>
		<description><![CDATA[There are several Flex upload components floating around and I gave most of them a good look over but I was not able to find one which suited my needs so I decided to make my own.  Here it is for you to enjoy.
Click here to view a demo
(demo lets you upload up to [...]]]></description>
			<content:encoded><![CDATA[<p>There are several Flex upload components floating around and I gave most of them a good look over but I was not able to find one which suited my needs so I decided to make my own.  Here it is for you to enjoy.</p>
<p><a href="http://www.kerkness.ca/flexexamples/uploader/UploadExample.html">Click here to view a demo</a><br />
<span style="font-size:85%;">(demo lets you upload up to 3 files at a time with a max size of 4 megs each)<br />
</span><br />
<a href="http://www.kerkness.ca/flexexamples/uploader/srcview/index.html">Click here to view the source</a></p>
<p>The usage of the component is pretty straight forward. You can set some properties to define what types of files can be uploaded and you direct the &#8216;upload&#8217; towards a server side script.  In my demo I send the files to a basic PHP script ( which I&#8217;ve included below ).  The script handles one file at a time and is expected to report back either the string &#8217;successful&#8217;  or an error message which is displayed.</p>
<p><span style="font-weight: bold;font-size:180%;">Properties</span></p>
<p>The following public properties can be set to customize the use of this component</p>
<ul>
<li><span style="font-style: italic;">uploadButtonLabel</span> : String = &#8216;Upload&#8217;<br />
This is the label used for the &#8216;upload&#8217; button.</li>
<li><span style="font-style: italic;">selectButtonLabel</span> : String = &#8216;Select File(s)&#8217;<br />
This is the label used for the &#8217;select&#8217; button.</li>
<li><span style="font-style: italic;">removeButtonLabel </span>: String = &#8216;Remove Selected File&#8217;<br />
This is the label used for the &#8216;remove&#8217; button.</li>
<li><span style="font-style: italic;">maxFileCount </span>: Number = 3<br />
This sets the number of files a user is allowed to upload</li>
<li><span style="font-style: italic;">maxFileSize </span>: Number = 1<br />
This sets the maximum file size (in megs) for each individual file. Default is 1 meg.</li>
<li><span style="font-style: italic;">requestUrl</span> : String = &#8221;<br />
This is the URL for your PHP/ASP/ColdFusion/Other script which you will send the uploaded files to. THIS PROPERTY MUST BE SET !</li>
<li><span style="font-style: italic;">allowOnlyImages </span>: Boolean = false<br />
If set to &#8216;true&#8217;  the user will only be able to select image files</li>
<li><span style="font-style: italic;">allowOnlyText </span>: Boolean = false<br />
If set to &#8216;true&#8217;  the user will only be able to select text files.</li>
<li><span style="font-style: italic;">allowAllFiles </span>: Boolean = true<br />
If set to &#8216;true&#8217; the user can upload images or text files.</li>
<li><span style="font-style: italic;">barColor </span>: String<br />
Allows you to style the progress bar</li>
</ul>
<p><span style="font-size:180%;"><span style="font-weight: bold;">Events</span><br />
</span><br />
The component has one event &#8216;uploadComplete&#8217;  which is triggered if all files are uploaded successfully.</p>
<p><span style="font-size:180%;"><span style="font-weight: bold;">The PHP Handler</span><br />
</span><br />
Following is the source for the simple PHP script which I am using in the demo. In this script I am just confirming that the file was uploaded successfully and then I am deleting it.  Since this is a public demo I don&#8217;t want people filling up my server with unwanted images.  In your script you would most likely copy the FILE to a more permanent location and possibly do a little more validation.  The script needs to echo the string &#8217;success&#8217;  or echo an error message.</p>
<pre>
$hasError = false;foreach( $_FILES as $i=&gt;$file ){
   if ( $file['error'] ){
      $hasError = true;
  }
  /**
    * Because this is a public example. I am just going to immediately delete
    * the file which was uploaded.  In a regular application you would copy the file
    * from it's temporary location to it's permament location.
    */
   unlink( $file['tmp_name'] );
 }
if ( ! $hasError ){
  echo('success');
} else {
  echo('Stick custom error message here');
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.kerkness.ca/flex-component-yet-another-flex-file-upload-component/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Multiple AutoComplete Input Controls in a single Flex Form</title>
		<link>http://www.kerkness.ca/multiple-autocomplete-input-controls-in-a-single-flex-form/</link>
		<comments>http://www.kerkness.ca/multiple-autocomplete-input-controls-in-a-single-flex-form/#comments</comments>
		<pubDate>Wed, 21 May 2008 01:20:00 +0000</pubDate>
		<dc:creator>Kerk</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://www.kerkness.ca/blog/?p=47</guid>
		<description><![CDATA[A very nice component which is available from Adobe is their AutoComplete ComboBox. The AutoComplete Combo box looks like a regular TextInput component but will provide suggestions to the user as they type.  This is very handy when you want to let users select from a long list of options ( such as a [...]]]></description>
			<content:encoded><![CDATA[<p>A very nice component which is available from Adobe is their <a href="http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&amp;extid=1047291">AutoComplete ComboBox</a>. The AutoComplete Combo box looks like a regular TextInput component but will provide suggestions to the user as they type.  This is very handy when you want to let users select from a long list of options ( such as a list of Countries ).</p>
<p>Jen Krause has posted a <a href="http://www.websector.de/blog/2008/04/30/quick-tip-avoid-issues-using-adobes-autocomplete-input-component-using-flex-3/#comment-18368">modified version</a> of the component which allows the user to press ENTER, TAB or click their mouse button to select the first selected item.  This is a very nice modification.</p>
<p>A problem I ran into however was using multiple AutoComplete components in the same Flex form. If you try and put more than one AutoComplete component in the form, the first component looses the label of the selected item when you begin using the second component.  I wasn&#8217;t able to determine the cause of this problem but I was able to provide a simple work around.</p>
<p>If you&#8217;ve run into a same problem, you can fix it by making the following change to the class&#8217; focusOutHandler method.
<pre>// Change this method ...override protected function focusOutHandler(event:FocusEvent):void{super.focusOutHandler(event)if(keepLocalHistory &amp;&amp; dataProvider.length==0)  addToLocalHistory();}

// To this ....override protected function focusOutHandler(event:FocusEvent):void{super.focusOutHandler(event)if(keepLocalHistory &amp;&amp; dataProvider.length==0)  addToLocalHistory();_typedText = textInput.text;   // replace typedText with textInput.text}</pre>
<p>I&#8217;m not sure if there are any ramifications to this fix but I haven&#8217;t found any additional problems in my own application.</p>
<p><span style="font-weight: bold;">UPDATE<br /></span>Turns out there are numberous implications when using multiple AutoComplete Input controls in the same form specifically when you want to try and set the value of the controls with actionscript.  If you only need one AutoComplete input control then this component works really well and is very user friendly. However if you need multiple controls you may want to re-consider your form design choices.<span style="font-weight: bold;"><br /></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kerkness.ca/multiple-autocomplete-input-controls-in-a-single-flex-form/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
