<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6449760275592537835</id><updated>2011-04-21T16:00:09.704-07:00</updated><category term='kerkness'/><category term='sudoku'/><category term='php-to-flex'/><category term='css'/><category term='mysql'/><category term='alert'/><category term='php'/><category term='mac'/><category term='blackbox'/><category term='php gmail'/><category term='forms'/><category term='kiosk'/><category term='components'/><category term='actionscript'/><category term='ubuntu'/><category term='links'/><category term='flex'/><category term='json'/><category term='adobe air'/><title type='text'>Flexing My Kerkness</title><subtitle type='html'>I have re-located my blog to..   Kerkness.ca</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>59</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-491957629937228540</id><published>2008-11-06T08:17:00.000-08:00</published><updated>2008-11-06T08:53:45.856-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><title type='text'>Creating an ItemRenderer in ActionScript</title><content type='html'>I'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'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.&lt;br /&gt;&lt;pre&gt;package my.renderer&lt;br /&gt;{&lt;br /&gt; import my.model.DataModel;&lt;br /&gt; &lt;br /&gt; import mx.controls.Label;&lt;br /&gt; import mx.controls.listClasses.IListItemRenderer;&lt;br /&gt; import mx.controls.listClasses.ListBase;&lt;br /&gt; import mx.core.UIComponent;&lt;br /&gt; &lt;br /&gt; public class ArtListRenderer extends UIComponent implements IListItemRenderer&lt;br /&gt; {&lt;br /&gt;  public function ArtListRenderer()&lt;br /&gt;  {&lt;br /&gt;   super();&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  &lt;br /&gt;     [Bindable] public var myData:DataModel = new DataModel();&lt;br /&gt;  &lt;br /&gt;     // Internal variable for the property value.&lt;br /&gt;     private var _data:Object;&lt;br /&gt;     &lt;br /&gt;     // Make the data property bindable.&lt;br /&gt;     [Bindable("dataChange")]&lt;br /&gt;     &lt;br /&gt;     // Define the getter method.&lt;br /&gt;     public function get data():Object {&lt;br /&gt;         return _data;&lt;br /&gt;     }&lt;br /&gt;     &lt;br /&gt;     // Define the setter method, and dispatch an event when the property&lt;br /&gt;     // changes to support data binding.&lt;br /&gt;     public function set data(value:Object):void {&lt;br /&gt;         _data = value;&lt;br /&gt;         &lt;br /&gt;         myData = new DataModel();&lt;br /&gt;         myData.firstname = value.firstname;&lt;br /&gt;         myData.lastname = value.lastname;&lt;br /&gt;                 &lt;br /&gt;         invalidateProperties();&lt;br /&gt;         dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));&lt;br /&gt;     }&lt;br /&gt;     &lt;br /&gt;     private var hBox:HBox;&lt;br /&gt;     private var firstnameLabel:Label;&lt;br /&gt;     private var lastnameLabel:Label;&lt;br /&gt;     &lt;br /&gt;     override protected function createChildren():void&lt;br /&gt;     {&lt;br /&gt;      super.createChildren();&lt;br /&gt;      &lt;br /&gt;      hBox = new HBox();&lt;br /&gt;      &lt;br /&gt;      firstnameLabel = new Label();&lt;br /&gt;      lastnameLabel = new Label();&lt;br /&gt;      hBox.addChild( firstnameLabel );&lt;br /&gt;      hBox.addChild( lastnameLabel );&lt;br /&gt;      &lt;br /&gt;     }  &lt;br /&gt;     &lt;br /&gt;     override protected function commitProperties():void&lt;br /&gt;     {&lt;br /&gt;      super.commitProperties();&lt;br /&gt;      &lt;br /&gt;      hBox.horizontalScrollPolicy = 'off';&lt;br /&gt;      hBox.verticalScrollPolicy = 'off';&lt;br /&gt;      &lt;br /&gt;      hBox.percentWidth = 100;&lt;br /&gt;      &lt;br /&gt;      firstnameLabel.text = myData.firstname;&lt;br /&gt;      lastnameLabel.text = myData.lastname;&lt;br /&gt;     }&lt;br /&gt;     &lt;br /&gt;     override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void&lt;br /&gt;     {&lt;br /&gt;      super.updateDisplayList(unscaledWidth,unscaledHeight);&lt;br /&gt;      hBox.move(0,0);&lt;br /&gt;      hBox.setActualSize( (unscaledWidth-4), unscaledHeight);&lt;br /&gt;     }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-491957629937228540?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/491957629937228540/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/11/creating-itemrenderer-in-actionscript.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/491957629937228540'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/491957629937228540'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/11/creating-itemrenderer-in-actionscript.html' title='Creating an ItemRenderer in ActionScript'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-6927437522340793368</id><published>2008-10-16T12:52:00.000-07:00</published><updated>2008-10-24T07:51:44.749-07:00</updated><title type='text'>Get PHP dynamic variables inside Flex</title><content type='html'>Let's say that before you load your flex application you want to pass some dynamic variables from PHP for it to act upon. This can be done pretty easily by slipping the values into PHP's&amp;nbsp; &lt;i&gt;$_GET&lt;/i&gt; array and using Flex's &lt;i&gt;ExternalInterface&lt;/i&gt; class to get access to them from inside the Flex app.&lt;br /&gt;&lt;br /&gt;Here is an example Flex application which pulls values from the URL Query String.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&amp;lt;mx:Application creationcomplete="init()" layout="absolute" xmlns:mx="http://www.adobe.com/2006/mxml"&amp;gt;&lt;br /&gt;&amp;lt;mx:Script&amp;gt;&lt;br /&gt;&amp;lt;![CDATA[&lt;br /&gt;private function init():void&lt;br /&gt;{&lt;br /&gt;  var qstr:String = ExternalInterface.call("window.location.search.substring", 1) as String;&lt;br /&gt;  var qarr:Array = qstr.split('&amp;amp;');&lt;br /&gt;&lt;br /&gt;  var pairs:Array;&lt;br /&gt;  for( var i:Number = 0 ; i &amp;lt; qarr.length; i++ ){&lt;br /&gt;     pairs = String( qarr[i] ).split('=');&lt;br /&gt;     if( pairs[0] == 'myName' ){&lt;br /&gt;           myName = pairs[1] as String;&lt;br /&gt;     }&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;]]&amp;gt;&lt;br /&gt;&amp;lt;/mx:Script&amp;gt;&lt;br /&gt;&amp;lt;mx:Label text="{myName}" /&amp;gt;&lt;br /&gt;&amp;lt;/mx:Application&amp;gt;&lt;/pre&gt;&lt;br /&gt;After you build the application and and Flex Builder has generated the &lt;i&gt;.html&lt;/i&gt; file that displays your Flex app&amp;nbsp; you can rename the file &lt;i&gt;.php&lt;/i&gt; and then add the following to the top of the file.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&amp;lt?php $_GET['myName'] = 'Hi I am Kerk'; ?&amp;gt;&lt;/pre&gt;&lt;br /&gt;Now if you upload your SWF file and PHP file to a server that is running PHP and you open it in your browser you'll&amp;nbsp; see your value from PHP displayed in your Flex app.&lt;br /&gt;&lt;br /&gt;I don't know if that is a clear explanation or not,&amp;nbsp; or if this is the best way to pass dynamic variables at load time into your flex application but it works for me.&amp;nbsp; Comments or alternative solutions welcome.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-6927437522340793368?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/6927437522340793368/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/10/get-php-dynamic-variables-inside-flex.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/6927437522340793368'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/6927437522340793368'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/10/get-php-dynamic-variables-inside-flex.html' title='Get PHP dynamic variables inside Flex'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-4066517962029800461</id><published>2008-10-03T09:23:00.000-07:00</published><updated>2008-10-03T09:32:54.275-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><title type='text'>Force creation of complete ViewStack with creationPolicy when building a form across multiple views : Flex Tip</title><content type='html'>Here's a tip which might be useful for some people.&amp;nbsp; Sometimes when building a Flex/Adobe Air interface you may want to have form elements which are built across multiple views of a &lt;i&gt;ViewStack&lt;/i&gt;, or &lt;i&gt;TabNavigator&lt;/i&gt;.&amp;nbsp; For example I have a contact form which has some rarely used fields contained in a secondary Tab in my form.&lt;br /&gt;&lt;br /&gt;Problem with this approach is that the default value of a Container's &lt;i&gt;&lt;b&gt;creationPolicy&lt;/b&gt;&lt;/i&gt; is '&lt;i&gt;auto&lt;/i&gt;'.&amp;nbsp; This means child components are only created when they are needed.&amp;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.&lt;br /&gt;&lt;br /&gt;The Solution is to simple set the &lt;b&gt;&lt;i&gt;creationPolicy&lt;/i&gt;&lt;/b&gt; for your &lt;i&gt;ViewStack&lt;/i&gt; or &lt;i&gt;TabNavigator&lt;/i&gt; to '&lt;i&gt;all&lt;/i&gt;'.&amp;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.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-4066517962029800461?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/4066517962029800461/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/10/force-creation-of-complete-viewstack.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/4066517962029800461'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/4066517962029800461'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/10/force-creation-of-complete-viewstack.html' title='Force creation of complete ViewStack with creationPolicy when building a form across multiple views : Flex Tip'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-8279490838141500660</id><published>2008-10-02T08:13:00.000-07:00</published><updated>2008-10-02T08:42:19.796-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><title type='text'>Flex Tip : Use ObjectUtil for Alpha and Numeric sorting on a DataGrid</title><content type='html'>If you haven't taken the time to look at the features of Flex's &lt;i&gt;ObjectUtil&lt;/i&gt; you should. Inside are a few handy methods which I see getting over looked.&lt;br /&gt;&lt;br /&gt;Two of those methods are &lt;i&gt;ObjectUtil&lt;/i&gt;.&lt;i&gt;stringCompare&lt;/i&gt; and &lt;i&gt;ObjectUtil&lt;/i&gt;.&lt;i&gt;numericCompare&lt;/i&gt;. These methods make it simple to provide intelegent sorting on &lt;i&gt;DataGrid&lt;/i&gt; columns.&lt;br /&gt;&lt;br /&gt;Let's say you have a &lt;i&gt;DataGrid&lt;/i&gt; that has one column full of ID# and another column full of people's names including both first and last names. Chances are the default sorting abilities of the &lt;i&gt;DataGrid&lt;/i&gt; will not properly sort either column. The ID# would be sorted 1,10,11,12... instead of 1,2,3,4,5... and the column of names would sort by the first name and not the last name.&lt;br /&gt;&lt;br /&gt;Lucky the &lt;i&gt;DataGridColumn&lt;/i&gt; allows you to set a custom sort function via the property &lt;i&gt;sortCompareFunction&lt;/i&gt;. For example look at these two &lt;i&gt;DataGridColumns&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&amp;lt;mx:DataGridColumn headerText="ID#" dataField="contactid" sortCompareFunction="sortContactId"/&amp;gt;&lt;br /&gt;&amp;lt;mx:DataGridColumn headerText="Name" dataField="full_name" sortCompareFunction="sortLastName"&amp;gt;&lt;br /&gt; &amp;lt;mx:itemRenderer&amp;gt;&lt;br /&gt;  &amp;lt;mx:Component&amp;gt;&lt;br /&gt;    &amp;lt;mx:Label paddingLeft="5" text="{data.firstname} {data.lastname}" /&amp;gt;&lt;br /&gt;  &amp;lt;/mx:Component&amp;gt;&lt;br /&gt; &amp;lt;/mx:itemRenderer&amp;gt;&lt;br /&gt;&amp;lt;/mx:DataGridGolumn&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The first column is for the ID# of a contact, the second column uses an &lt;i&gt;itemRenderer&lt;/i&gt; and displays both the &lt;i&gt;firstname&lt;/i&gt; and &lt;i&gt;lastname&lt;/i&gt; for the contact. Each column defines it's own &lt;i&gt;sortCompareFunction&lt;/i&gt;. Both functions make use of methods from &lt;i&gt;mx.utils.ObjectUtil&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;private function sortLastName(obj1:Object,obj2:Object):int&lt;br /&gt;{&lt;br /&gt;   var value1:String = (obj1.lastname == '' || obj1.lastname == null) ? null : new String(obj1.lastname);&lt;br /&gt;   var value2:String = (obj2.lastname == '' || obj2.lastname == null) ? null : new String(obj2.lastname);&lt;br /&gt;   return ObjectUtil.stringCompare( value1, value2, true );&lt;br /&gt;}&lt;br /&gt;private function sortContactId(obj1:Object,obj2:Object):int&lt;br /&gt;{&lt;br /&gt;   var value1:Number = (obj1.contactid == '' || obj1.contactid == null) ? null : new Number(obj1.contactid);&lt;br /&gt;   var value2:Number = (obj2.contactid == '' || obj2.contactid == null) ? null : new Number(obj2.contactid);&lt;br /&gt;   return ObjectUtil.numericCompare( value1, value2 );&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;These functions are pretty straight forward.&amp;nbsp; &lt;i&gt;sortLastName&lt;/i&gt; function uses &lt;i&gt;stringCompare&lt;/i&gt; method to compare the &lt;i&gt;lastname&lt;/i&gt; from two objects. The flag 'true' is set to make sure that the comparison is case insensitive. The &lt;i&gt;sortContactId&lt;/i&gt; function uses the &lt;i&gt;numericCompare&lt;/i&gt; method to compare the &lt;i&gt;contactid&lt;/i&gt; from two objects.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-8279490838141500660?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/8279490838141500660/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/10/flex-tip-use-objectutil-for-alpha-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/8279490838141500660'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/8279490838141500660'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/10/flex-tip-use-objectutil-for-alpha-and.html' title='Flex Tip : Use ObjectUtil for Alpha and Numeric sorting on a DataGrid'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-4228717575582889031</id><published>2008-10-01T19:21:00.000-07:00</published><updated>2008-10-01T19:29:04.681-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='components'/><title type='text'>Flex Component : ButtonPanel puts a button in your panel header</title><content type='html'>It's always a joy when you need something and after writing a few lines of code, you have it. Such is the beauty of nice extendable components and the Flex architecture.&lt;br /&gt;&lt;br /&gt;Today I needed a panel which had a button in the top right corner of the header. Where the 'status' text is normally is.  I wanted to put a 'save' button there.  One problem, the mx.containers.Panel component does not have a button in the header.&lt;br /&gt;&lt;br /&gt;Solution.  Make a new component which extends all the functions of the Panel and stick a button in the top corner where I want.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://kerkness.ca/flexexamples/ButtonPanel/ButtonPanelDemo.html"&gt;Click here to see a demo&lt;/a&gt;&lt;a href="http://draft.blogger.com/goog_1222914079825"&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://kerkness.ca/flexexamples/ButtonPanel/srcview/index.html"&gt;Click here to view the source&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;My new ButtonPanel component extends Panel and adds 2 new properties and 1 event.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Properties&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;buttonLabel : &lt;i&gt;String&lt;/i&gt; - Defines the label for the button in the top corner&lt;br /&gt;buttonPadding : &lt;i&gt;Number&lt;/i&gt; - Defines how much padding to provide in the header&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Event&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;buttonClick : &lt;i&gt;Event&lt;/i&gt; - Dispatched when the button is clicked&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-4228717575582889031?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/4228717575582889031/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/10/flex-component-buttonpanel-puts-button.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/4228717575582889031'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/4228717575582889031'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/10/flex-component-buttonpanel-puts-button.html' title='Flex Component : ButtonPanel puts a button in your panel header'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-7166402995688755947</id><published>2008-10-01T14:55:00.000-07:00</published><updated>2008-10-01T15:00:18.163-07:00</updated><title type='text'>Flex Tip: ArrayCollection replace an item with setItemAt</title><content type='html'>One thing which might not be clear when working with &lt;i&gt;ArrayCollections&lt;/i&gt; in Flex is how to replace an item in the collection.&amp;nbsp; The methods &lt;i&gt;getItemAt&lt;/i&gt; and &lt;i&gt;addItemAt&lt;/i&gt; are pretty clear in their purpose, but one method which I found myself over looking is the &lt;i&gt;setItemAt&lt;/i&gt; method which could be more aptly named &lt;i&gt;replaceItemAt&lt;/i&gt; as that is exactly what it does.&amp;nbsp; It replaces an item in the collection.&lt;br /&gt;&lt;br /&gt;So next time you're looking to replace an item in an &lt;i&gt;ArrayCollection&lt;/i&gt; and wishing there was a &lt;i&gt;replaceItemAt&lt;/i&gt; method, look no further than &lt;a href="http://livedocs.adobe.com/flex/201/langref/mx/collections/ListCollectionView.html#setItemAt%28%29"&gt;setItemAt&lt;/a&gt;.&amp;nbsp;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-7166402995688755947?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/7166402995688755947/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/10/flex-tip-arraycollection-replace-item.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/7166402995688755947'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/7166402995688755947'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/10/flex-tip-arraycollection-replace-item.html' title='Flex Tip: ArrayCollection replace an item with setItemAt'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-4839334076194586292</id><published>2008-09-13T11:19:00.000-07:00</published><updated>2008-09-13T11:34:42.157-07:00</updated><title type='text'>PHP json_encode() and Flex JSON.decode Gotcha</title><content type='html'>I came across a little 'gotcha' when trying to get Flex &lt;i&gt;&lt;b&gt;JSON.decode&lt;/b&gt;&lt;/i&gt; to properly decode a JSON string I was producing with PHP. &lt;br /&gt;&lt;br /&gt;The one of the elements in the string contained ' &lt;i&gt;&lt;b&gt;&amp;amp;quote;&lt;/b&gt;&lt;/i&gt; ' which when being encoded by php and sent as a &lt;i&gt;&lt;b&gt;HTTPService&lt;/b&gt;&lt;/i&gt; response back to my Flex application was being converted back into double quotes ( &lt;i&gt;&lt;b&gt;"&lt;/b&gt;&lt;/i&gt; ). When Flex &lt;i&gt;&lt;b&gt;JSON.decode &lt;/b&gt;&lt;/i&gt;attempted to decode the string it would silently fail.  No errors or anything.&lt;br /&gt;&lt;br /&gt;In my case my JSON string was already pretty complicated with lots of variable content so it took a while to figure this out.  Hopefully someone else finds this post and saves themselves some time.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-4839334076194586292?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/4839334076194586292/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/09/php-jsonencode-and-flex-jsondecode.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/4839334076194586292'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/4839334076194586292'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/09/php-jsonencode-and-flex-jsondecode.html' title='PHP json_encode() and Flex JSON.decode Gotcha'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-5445744162381592106</id><published>2008-09-06T11:23:00.001-07:00</published><updated>2008-09-06T13:33:32.169-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php-to-flex'/><title type='text'>PHP trim() function in Actionscript for Flex</title><content type='html'>Here is PHP's trim() function reproduced in Actionscript for use in a Flex application&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;public function trim(str:String):String&lt;br /&gt;{&lt;br /&gt;    for(var i:Number = 0; str.charCodeAt(i) &lt; 33; i++);    &lt;br /&gt;    for(var j:Number = str.length-1; str.charCodeAt(j) &lt; 33; j--);&lt;br /&gt;    return str.substring(i, j+1);&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;UPDATE:  Thanks to Almog Kurtser, I now know that Flex has a utility to handle trimming strings.  Here is an alternative example&lt;br /&gt;&lt;pre&gt;import mx.utils.StringUtil;&lt;br /&gt;&lt;br /&gt;public function trim(str:String):String&lt;br /&gt;{&lt;br /&gt;   return StringUtil.trim(str);&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Of course it is redundant to actually create a function called trim just to call the method StringUtil.trim()  but you get the idea.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-5445744162381592106?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/5445744162381592106/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/09/php-trim-function-in-actionscript-for.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/5445744162381592106'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/5445744162381592106'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/09/php-trim-function-in-actionscript-for.html' title='PHP trim() function in Actionscript for Flex'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-7869092813196781617</id><published>2008-09-05T13:09:00.000-07:00</published><updated>2008-09-05T13:42:04.213-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php gmail'/><title type='text'>GmailReader.php :  A PHP IMAP Class for Reading your Gmail Account</title><content type='html'>One of the requirements I had for a recent project involved keeping track of email communication from multiple Gmail users. My first thought was to simply forward a copy of all incoming and outgoing email to an email account on my server and accessing the email that way.  There was one problem with this approach.  Gmail only allows you to forward a copy of incoming email somewhere else.  Emails composed in Gmail stay in Gmail.&lt;br /&gt;&lt;br /&gt;My solution:  Use Gmail's IMAP capabilities and monitor the accounts using &lt;a href="http://ca3.php.net/manual/en/ref.imap.php"&gt;PHP-IMAP&lt;/a&gt;.  This turned out to be a fairly easy to implement solution but I thought I would post my GmailReader class to save other people some initial headaches of getting things rolling.&lt;br /&gt;&lt;br /&gt;First of all you'll need to enable IMAP for you Gmail Account.  Log into Gmail and goto Settings &gt; Forwarding and POP/IMAP&lt;br /&gt;&lt;br /&gt;Next you'll need to make sure php is compiled with IMAP enabled.  This can be done on ubuntu with the following command and then restart apache for good measure.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;sudo apt-get install php5-imap&lt;br /&gt;sudo /etc/init.d/apache2 restart&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In my particular scenario I run a script every so often to look for new emails since the last time I checked. So the class file is structured to check for new emails since a specific date string.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Usage Example&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;include_once( 'GmailReader.php' );&lt;br /&gt;$gmail = new GmailReader( 'username@gmail.com', 'password' ); &lt;br /&gt;$email = $gmail-&amp;gt;getEmailSince('Fri, 5 Sep 2008 9:00:00');&lt;br /&gt;&lt;br /&gt;print_r($email);&lt;br /&gt;&lt;/pre&gt;The above example will print out an array of all emails ( still in the Inbox ) which arrived no earlier than 9am on the 5th of September.&lt;br /&gt;&lt;br /&gt;You can also check your sent mail using the following example.&lt;br /&gt;&lt;pre&gt;$gmail = new GmailReader( 'username@gmail.com', 'password' );&lt;br /&gt;$gmail-&amp;gt;openSentMail(); &lt;br /&gt;$email = $gmail-&amp;gt;getEmailSince('Fri, 5 Sep 2008 9:00:00');&lt;/pre&gt;Also, if you use Gmail to apply labels to certain email you can monitor just these emails as well.&lt;br /&gt;&lt;pre&gt;$gmail = new GmailReader( 'username@gmail.com', 'password' );&lt;br /&gt;$gmail-&amp;gt;openMailBox( 'MYLABEL' ); &lt;br /&gt;$email = $gmail-&amp;gt;getEmailSince('Fri, 5 Sep 2008 9:00:00'); &lt;/pre&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Here is the full GmailReader Class File.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;class GmailReader&lt;br /&gt;{&lt;br /&gt;var $mbox;&lt;br /&gt;&lt;br /&gt;function GmailReader( $user, $pass )&lt;br /&gt;{&lt;br /&gt; $this-&gt;mbox = imap_open("{imap.gmail.com:993/imap/ssl}INBOX",$user,$pass)&lt;br /&gt;  or die("can't connect: " . imap_last_error());&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function openSentMail()&lt;br /&gt;{&lt;br /&gt; imap_reopen($this-&gt;mbox, "{imap.gmail.com:993/imap/ssl}[Gmail]/Sent Mail" )&lt;br /&gt;  or die("Failed to open Sent Mail: " . imap_last_error());&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function openMailBox($mailbox)&lt;br /&gt;{&lt;br /&gt; imap_reopen($this-&gt;mbox, "{imap.gmail.com:993/imap/ssl}$mailbox" )&lt;br /&gt;  or die("Failed to open $mailbox: " . imap_last_error());&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function getMailboxInfo()&lt;br /&gt;{&lt;br /&gt; $mc = imap_check($this-&gt;mbox);&lt;br /&gt; return $mc;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * $date should be a string&lt;br /&gt; * Example Formats Include:&lt;br /&gt; * Fri, 5 Sep 2008 9:00:00&lt;br /&gt; * Fri, 5 Sep 2008&lt;br /&gt; * 5 Sep 2008&lt;br /&gt; * I am sure other's work, just test them out.&lt;br /&gt; */&lt;br /&gt;function getHeadersSince($date)&lt;br /&gt;{&lt;br /&gt; $uids = $this-&gt;getMessageIdsSinceDate($date);&lt;br /&gt; $messages = array();&lt;br /&gt; foreach( $uids as $k=&gt;$uid )&lt;br /&gt; {&lt;br /&gt;  $messages[] = $this-&gt;retrieve_header($uid);&lt;br /&gt; }&lt;br /&gt; return $messages;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * $date should be a string&lt;br /&gt; * Example Formats Include:&lt;br /&gt; * Fri, 5 Sep 2008 9:00:00&lt;br /&gt; * Fri, 5 Sep 2008&lt;br /&gt; * 5 Sep 2008&lt;br /&gt; * I am sure other's work, just test them out.&lt;br /&gt; */&lt;br /&gt;function getEmailSince($date)&lt;br /&gt;{&lt;br /&gt; $uids = $this-&gt;getMessageIdsSinceDate($date);&lt;br /&gt; $messages = array();&lt;br /&gt; foreach( $uids as $k=&gt;$uid )&lt;br /&gt; {&lt;br /&gt;  $messages[] = $this-&gt;retrieve_message($uid);&lt;br /&gt; }&lt;br /&gt; return $messages;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function getMessageIdsSinceDate($date)&lt;br /&gt;{&lt;br /&gt; return imap_search( $this-&gt;mbox, 'SINCE "'.$date.'"');&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function retrieve_header($messageid)&lt;br /&gt;{&lt;br /&gt;   $message = array();&lt;br /&gt;  &lt;br /&gt;   $header = imap_header($this-&gt;mbox, $messageid);&lt;br /&gt;   $structure = imap_fetchstructure($this-&gt;mbox, $messageid);&lt;br /&gt;&lt;br /&gt;   $message['subject'] = $header-&gt;subject;&lt;br /&gt;   $message['fromaddress'] =   $header-&gt;fromaddress;&lt;br /&gt;   $message['toaddress'] =   $header-&gt;toaddress;&lt;br /&gt;   $message['ccaddress'] =   $header-&gt;ccaddress;&lt;br /&gt;   $message['date'] =   $header-&gt;date;&lt;br /&gt;&lt;br /&gt;   return $message;  &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function retrieve_message($messageid)&lt;br /&gt;{&lt;br /&gt;   $message = array();&lt;br /&gt;  &lt;br /&gt;   $header = imap_header($this-&gt;mbox, $messageid);&lt;br /&gt;   $structure = imap_fetchstructure($this-&gt;mbox, $messageid);&lt;br /&gt;&lt;br /&gt;   $message['subject'] = $header-&gt;subject;&lt;br /&gt;   $message['fromaddress'] =   $header-&gt;fromaddress;&lt;br /&gt;   $message['toaddress'] =   $header-&gt;toaddress;&lt;br /&gt;   $message['ccaddress'] =   $header-&gt;ccaddress;&lt;br /&gt;   $message['date'] =   $header-&gt;date;&lt;br /&gt;&lt;br /&gt;  if ($this-&gt;check_type($structure))&lt;br /&gt;  {&lt;br /&gt;   $message['body'] = imap_fetchbody($this-&gt;mbox,$messageid,"1"); ## GET THE BODY OF MULTI-PART MESSAGE&lt;br /&gt;   if(!$message['body']) {$message['body'] = '[NO TEXT ENTERED INTO THE MESSAGE]\n\n';}&lt;br /&gt;  }&lt;br /&gt;  else&lt;br /&gt;  {&lt;br /&gt;   $message['body'] = imap_body($this-&gt;mbox, $messageid);&lt;br /&gt;   if(!$message['body']) {$message['body'] = '[NO TEXT ENTERED INTO THE MESSAGE]\n\n';}&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;  return $message;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function check_type($structure) ## CHECK THE TYPE&lt;br /&gt;{&lt;br /&gt;  if($structure-&gt;type == 1)&lt;br /&gt;    {&lt;br /&gt;     return(true); ## YES THIS IS A MULTI-PART MESSAGE&lt;br /&gt;    }&lt;br /&gt; else&lt;br /&gt;    {&lt;br /&gt;     return(false); ## NO THIS IS NOT A MULTI-PART MESSAGE&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-7869092813196781617?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/7869092813196781617/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/09/gmailreaderphp-php-imap-class-for.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/7869092813196781617'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/7869092813196781617'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/09/gmailreaderphp-php-imap-class-for.html' title='GmailReader.php :  A PHP IMAP Class for Reading your Gmail Account'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-6193720207738183213</id><published>2008-08-29T14:32:00.000-07:00</published><updated>2008-09-02T09:56:01.892-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><title type='text'>Flex : DataGrid ItemRenderer and DoubleClick Oh My !!</title><content type='html'>I love it when you come across those little 'gotchas' when programming.  Today I found one and it took a while to figure out a solution/hack so I thought I would post my findings and save someone else a little time.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;Scenario&lt;/b&gt;&lt;/i&gt;: You have a DataGrid which uses an ItemRenderer to display the contents of a cell and you need this DataGrid to respond to DoubleClick events.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;Problem&lt;/b&gt;&lt;/i&gt;: The DoubleClick does not fire when the clicking occures in the white space of the item renderer.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;Solution&lt;/b&gt;&lt;/i&gt;: Enable DoubleClick in the itemRenderer as well and send the event to a dummy event handler.&lt;br /&gt;&lt;br /&gt;Here's an example to clarify.  First a MXML component containing the DataGrid.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&amp;lt;mx:Script&amp;gt;&lt;br /&gt;&amp;lt;![CDATA[&lt;br /&gt;import mx.controls.Alert;&lt;br /&gt;private function dblClickHandler(event:ListEvent):void&lt;br /&gt;{ &lt;br /&gt;  Alert.show("Double your fun");&lt;br /&gt;}&lt;br /&gt;]]&amp;gt;&amp;lt;/mx:Script&amp;gt;&lt;br /&gt;&amp;lt;mx:DataGrid id="myGrid" width="100%" dataProvider="{myArrayCollection}"&lt;br /&gt;doubleClickEnabled="true" itemDoubleClick="dblClickHandler(event)"&amp;gt;&lt;br /&gt; &amp;lt;mx:columns&amp;gt;   &lt;br /&gt;  &amp;lt;mx:DataGridColumn headerText="Col1" itemRenderer="claire.renderer.myCol" /&amp;gt; &lt;br /&gt;  &amp;lt;/mx:columns&amp;gt;&lt;br /&gt;&amp;lt;/mx:DataGrid&amp;gt;&lt;/pre&gt;&lt;br /&gt;Here is the itemRenderer &lt;i&gt; claire.renderer.myCol&lt;/i&gt;. Basically we enable double click and for the doubleClick event and we send the event to a dummy handler &lt;i&gt;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&amp;lt;mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" doubleClickEnabled="true"&lt;br /&gt; doubleClick="dummyClickHandler(event)"&amp;gt;&lt;br /&gt;&amp;lt;mx:Script&amp;gt;&lt;br /&gt;&amp;lt;![CDATA[&lt;br /&gt;private function dummyClickHandler(event:Event):void&lt;br /&gt;{ &lt;br /&gt;  // do nothing&lt;br /&gt;}&lt;br /&gt;]]&amp;gt;&lt;br /&gt;&amp;lt;/mx:Script&amp;gt;&lt;br /&gt;&amp;lt;mx:Label text="{data.artistName}" fontWeight="bold"/&amp;gt; &lt;br /&gt;&amp;lt;mx:Label text="{data.artworkMedium}" fontStyle="italic"/&amp;gt; &lt;br /&gt;&amp;lt;mx:Label text="{data.artworkSize}"/&amp;gt;&lt;br /&gt;&amp;lt;/mx:VBox&amp;gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-6193720207738183213?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/6193720207738183213/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/08/flex-datagrid-itemrenderer-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/6193720207738183213'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/6193720207738183213'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/08/flex-datagrid-itemrenderer-and.html' title='Flex : DataGrid ItemRenderer and DoubleClick Oh My !!'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-3591890522257471298</id><published>2008-08-20T10:06:00.000-07:00</published><updated>2008-08-20T14:04:00.034-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='kerkness'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Kerkness, A PHP Framework for RIA Development</title><content type='html'>For the past seven or eight years I've been developing and re-developing a PHP framework which I use as a backend model for almost all of my professional and personal projects.  Currently I'm in the process of finishing a re-built from the ground up version that has been tailored for RIA development.&lt;br /&gt;&lt;br /&gt;The new version is suitable for supporting the backend functionality of any Ajax or HTTP Request type application or web site.   I currently use the framework as a backend for Adobe Flex/Air projects as well as a backend for modular web development.&lt;br /&gt;&lt;br /&gt;With this new version I am also finally making a concious effort to release the framework in under a &lt;a href="http://www.gnu.org/licenses/"&gt;GNU General Public License&lt;/a&gt; as published by the Free Software Foundation.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="font-size:large;"&gt;How Kerkness Works     &lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Kerkness is a MVC ( module, view, controller ) framework for php specifically designed to provide back end functionality for dynamic web sites and rich internet applications.&lt;br /&gt;&lt;br /&gt;The Kerkness framework contains several core modules and class objects that aid developers when building custom modules and web services.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Making Requests&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;By default the Kerkness framework receives requests via HTTP and returns a JSON formatted response. However it also has the ability to return a response based on a custom designed template such as HTML or XML.&lt;br /&gt;&lt;br /&gt;A typical request could look like this.&lt;br /&gt;&lt;a href="http://kerkness.ca/request.php?kr=pages.home" onclick="window.open(this.href, '_blank'); return false;"&gt;http://kerkness.ca/request.php?kr=pages.home&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;or like this with clean URLs enabled&lt;br /&gt;&lt;a href="http://kerkness.ca/pages.home" onclick="window.open(this.href, '_blank'); return false;"&gt;http://kerkness.ca/pages.home&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This request is asking for the &lt;i&gt;' home '&lt;/i&gt; view from the &lt;i&gt;' pages '&lt;/i&gt; module. When this request is received the Kerkness framework creates a request object and will execute the script &lt;i&gt;&lt;b&gt;../kerk/modules/pages/home.php&lt;/b&gt;&lt;/i&gt;. The response is returned as a JSON formatted string or designated HTML template.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Request Chain&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Requests can be linked together to create a Request Chain so that multiple requests can be called one after another. Kerkness remains flexible and is able to respond to simple AJAX type requests but can also serve complete web pages showing many dynamic content blocks.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Getting Started&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://kerkness.wikidot.com/getting-started"&gt;Click here for a simple tutorial to get up and running quickly.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://kerkness.wikidot.com/"&gt;Click here to see the Kerkness Wiki&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Watch this blog for more information and tutorials as I have time to write them.  If you wish to get involved or have questions about the framework please leave me a comment.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-3591890522257471298?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/3591890522257471298/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/08/kerkness-php-framework-for-ria.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/3591890522257471298'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/3591890522257471298'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/08/kerkness-php-framework-for-ria.html' title='Kerkness, A PHP Framework for RIA Development'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-713298245048909449</id><published>2008-07-31T12:24:00.000-07:00</published><updated>2008-07-31T12:57:02.604-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='components'/><title type='text'>Updated Flex Qwerty Component</title><content type='html'>I've made some updates and improvements to my &lt;a href="http://kerkness.blogspot.com/2008/02/flex-on-screen-qwerty-keyboard.html"&gt;Flex Qwerty Keyboard Component&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;This version of the component is a little more tailored for a touch screen kiosk and is modled a little after the soft-touch keyboard you see on Apples' iPhone.  The main new features are shortcut buttons for typing '.com' and '.ca' (cause I'm Canadian)  as well as a 'Tab' button for tabbing through form fields.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.kerkness.ca/flexexamples/QwertyDemo/QwertyDemo.html"&gt;You can view a demo of the updated component here.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.kerkness.ca/flexexamples/QwertyDemo/srcview/index.html"&gt;You can view the source code for the updated component here.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;b&gt;How to Customize this Component&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;I've had a few comments and questions about how to customize this component.  It should be fairly straight forward to do if all you want to do is add or modify how a button works.  Here are instructions on how to add an 'Enter' or 'Return' button to the keyboard.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;First step is to physically add the button to the keyboard.  This can be done by adding a new object to one of the &lt;i&gt;&lt;b&gt;keyRow&lt;/b&gt;&lt;/i&gt; arrays in the &lt;i&gt;qwerty.mxml&lt;/i&gt; file. Adding the following object to the end of the &lt;i&gt;&lt;b&gt;keyRowC&lt;/b&gt;&lt;/i&gt; array will add the button to the end of row 3 of the keyboard.&lt;br /&gt;&lt;pre&gt;{label:'Return',w:100}&lt;/pre&gt;The property 'w' specifies that the button should be 100 pixels wide.  Alternatively you could set the property 'flex' to 'true' which would make the button take up as much available space as is available.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Next you need to instruct the component on how to handle the click event for this new button.  You do this by adding a condition to the switch statement in the function &lt;i&gt;&lt;b&gt;handleKeyClick&lt;/b&gt;&lt;/i&gt;().  Add the following condition for the new Return button.&lt;br /&gt;&lt;pre&gt;case 'Return': this.inputControl.text += "\n";break;&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;Finally we need to modify the function which handles toggling between Upper and Lower case on the keyboard.  We don't want our new button to be affected by this toggling so we will adjust this function to bypass our new button.&lt;br /&gt;&lt;br /&gt;In the function  &lt;b&gt;&lt;i&gt;toggleUpperLower&lt;/i&gt;&lt;/b&gt;()  edit the following line  from this...&lt;br /&gt;&lt;pre&gt;if ( kidLabel == 'Tab' || kidLabel == 'Delete' ) continue;&lt;/pre&gt;to this...&lt;br /&gt;&lt;pre&gt;if ( kidLabel == 'Tab' || kidLabel == 'Delete' || kidLabel == 'Return' ) continue;&lt;/pre&gt;&lt;/li&gt;&lt;/ol&gt;There you go, you should have a functional return button.  If you have any problems with this example please let me know in the comments.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-713298245048909449?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/713298245048909449/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/07/updated-flex-qwerty-component.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/713298245048909449'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/713298245048909449'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/07/updated-flex-qwerty-component.html' title='Updated Flex Qwerty Component'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-3847620903904133260</id><published>2008-06-26T14:42:00.000-07:00</published><updated>2008-06-26T15:12:13.967-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='components'/><title type='text'>Flex Component : Yet Another Flex File Upload Component</title><content type='html'>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.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.kerkness.ca/flexexamples/uploader/UploadExample.html"&gt;Click here to view a demo&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;(demo lets you upload up to 3 files at a time with a max size of 4 megs each)&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;a href="http://www.kerkness.ca/flexexamples/uploader/srcview/index.html"&gt;Click here to view the source&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;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 'upload' towards a server side script.  In my demo I send the files to a basic PHP script ( which I've included below ).  The script handles one file at a time and is expected to report back either the string 'successful'  or an error message which is displayed.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:180%;" &gt;Properties&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The following public properties can be set to customize the use of this component&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;uploadButtonLabel&lt;/span&gt; : String = 'Upload'&lt;br /&gt;This is the label used for the 'upload' button.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;selectButtonLabel&lt;/span&gt; : String = 'Select File(s)'&lt;br /&gt;This is the label used for the 'select' button.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;removeButtonLabel &lt;/span&gt;: String = 'Remove Selected File'&lt;br /&gt;This is the label used for the 'remove' button.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;maxFileCount &lt;/span&gt;: Number = 3&lt;br /&gt;This sets the number of files a user is allowed to upload&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;maxFileSize &lt;/span&gt;: Number = 1&lt;br /&gt;This sets the maximum file size (in megs) for each individual file. Default is 1 meg.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;requestUrl&lt;/span&gt; : String = ''&lt;br /&gt;This is the URL for your PHP/ASP/ColdFusion/Other script which you will send the uploaded files to. THIS PROPERTY MUST BE SET !&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;allowOnlyImages &lt;/span&gt;: Boolean = false&lt;br /&gt;If set to 'true'  the user will only be able to select image files&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;allowOnlyText &lt;/span&gt;: Boolean = false&lt;br /&gt;If set to 'true'  the user will only be able to select text files.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;allowAllFiles &lt;/span&gt;: Boolean = true&lt;br /&gt;If set to 'true' the user can upload images or text files.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;barColor &lt;/span&gt;: String&lt;br /&gt;Allows you to style the progress bar&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:180%;"&gt;&lt;span style="font-weight: bold;"&gt;Events&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;The component has one event 'uploadComplete'  which is triggered if all files are uploaded successfully.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:180%;"&gt;&lt;span style="font-weight: bold;"&gt;The PHP Handler&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;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'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 'success'  or echo an error message.&lt;br /&gt;&lt;pre&gt;$hasError = false;&lt;br /&gt;foreach( $_FILES as $i=&gt;$file ){&lt;br /&gt;  if ( $file['error'] ){&lt;br /&gt;     $hasError = true;&lt;br /&gt;  }&lt;br /&gt;  /**&lt;br /&gt;   * Because this is a public example. I am just going to immediately delete&lt;br /&gt;   * the file which was uploaded.  In a regular application you would copy the file&lt;br /&gt;   * from it's temporary location to it's permament location.&lt;br /&gt;   */&lt;br /&gt;   unlink( $file['tmp_name'] );  &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;if ( ! $hasError ){&lt;br /&gt;  echo('success');&lt;br /&gt;} else {&lt;br /&gt;  echo('Stick custom error message here');&lt;br /&gt;}&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-3847620903904133260?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/3847620903904133260/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/06/flex-component-yet-another-flex-file.html#comment-form' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/3847620903904133260'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/3847620903904133260'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/06/flex-component-yet-another-flex-file.html' title='Flex Component : Yet Another Flex File Upload Component'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-3192334157187266000</id><published>2008-06-20T15:33:00.000-07:00</published><updated>2008-06-20T15:44:04.171-07:00</updated><title type='text'>Locking Down the Ubuntu Log-In Screen</title><content type='html'>One of the requirements I have for a kiosk project is to use a timed login instead of an automatic log in when the server boots. This is required so that some special drivers for the touchscreen have time to load and also gives an admin time to log-in using their profile if need be.&lt;br /&gt;&lt;br /&gt;When the computer boots the Ubuntu login screen is displayed for 10 seconds before the limited user account is automatically logged in and the kiosk application is automatically launched.&lt;br /&gt;&lt;br /&gt;The problem with this process is that during this 10 second window someone could change the login session from the default ( I normally use blackbox ) to something else by using the little "options" button in the bottom left corner. ( or at least it's in the bottom left corner of the default Ubuntu login theme 'human' ).&lt;br /&gt;&lt;br /&gt;If you want to lock down or even just customize the login screen to suit your needs an easy way to do this is to edit the XML file which defines and places the elements on the login window.  You can edit the main file for the default human theme with gedit.&lt;br /&gt;&lt;pre&gt;cd /usr/share/gdm/themes/Human&lt;br /&gt;sudo cp Human.xml Human.xml.backup&lt;br /&gt;sudo gedit Human.xml&lt;/pre&gt;In my file I just commented out the &amp;lt;item&amp;gt; element which defined the option button.  Voila !  No more option button.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-3192334157187266000?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/3192334157187266000/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/06/locking-down-ubuntu-log-in-screen.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/3192334157187266000'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/3192334157187266000'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/06/locking-down-ubuntu-log-in-screen.html' title='Locking Down the Ubuntu Log-In Screen'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-1057534885972771234</id><published>2008-06-04T09:10:00.001-07:00</published><updated>2008-06-04T09:17:06.919-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='components'/><title type='text'>Something I need to remember about ItemRenderers and the TileList control</title><content type='html'>&lt;blockquote&gt;&lt;span&gt;From a high level perspective, scrolling is moving  &lt;/span&gt;&lt;span&gt;data through fixed &lt;b class="highlight"&gt;itemRenderers&lt;/b&gt;, not by actually moving renderers &lt;b class="highlight"&gt;off&lt;/b&gt; the visible area &lt;b class="highlight"&gt;of&lt;/b&gt;  &lt;/span&gt;&lt;br /&gt;&lt;span&gt;the screen.&lt;/span&gt;&lt;/blockquote&gt;I found this little bit of information hidden in &lt;a href="http://www.nabble.com/Re%3A-TileList-and-itemrenderer-customization-p14564260.html"&gt;this thread&lt;/a&gt;. After trying to extensively use my PageList component in a large application and with a dataProvider that had the potential of providing hundreds of items needing rendering I was noticing a very bad side effect. My application would continue to create a new instance of the itemRenderer for every item in the dataProvider and if the dataProvider was emptied ( ie:  arrayCollection.removeAll() ) the itemRenderers would remain.&lt;br /&gt;&lt;br /&gt;Back to the drawing board on that one.   I hope to post a new PageList component soon as my application is not usable in it's current state.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-1057534885972771234?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/1057534885972771234/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/06/something-i-need-to-remember-about.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/1057534885972771234'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/1057534885972771234'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/06/something-i-need-to-remember-about.html' title='Something I need to remember about ItemRenderers and the TileList control'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-8935212492404221126</id><published>2008-05-20T13:20:00.001-07:00</published><updated>2008-05-21T17:04:21.492-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><title type='text'>Multiple AutoComplete Input Controls in a single Flex Form</title><content type='html'>A very nice component which is available from Adobe is their &lt;a href="http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&amp;amp;extid=1047291"&gt;AutoComplete ComboBox&lt;/a&gt;. 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 ).&lt;br /&gt;&lt;br /&gt;Jen Krause has posted a &lt;a href="http://www.websector.de/blog/2008/04/30/quick-tip-avoid-issues-using-adobes-autocomplete-input-component-using-flex-3/#comment-18368"&gt;modified version&lt;/a&gt; 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.&lt;br /&gt;&lt;br /&gt;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't able to determine the cause of this problem but I was able to provide a simple work around.&lt;br /&gt;&lt;br /&gt;If you've run into a same problem, you can fix it by making the following change to the class' focusOutHandler method.&lt;br /&gt;&lt;pre&gt;// Change this method ...&lt;br /&gt;override protected function focusOutHandler(event:FocusEvent):void&lt;br /&gt;{&lt;br /&gt;super.focusOutHandler(event)&lt;br /&gt;if(keepLocalHistory &amp;amp;&amp;amp; dataProvider.length==0)&lt;br /&gt;  addToLocalHistory();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// To this ....&lt;br /&gt;override protected function focusOutHandler(event:FocusEvent):void&lt;br /&gt;{&lt;br /&gt;super.focusOutHandler(event)&lt;br /&gt;if(keepLocalHistory &amp;amp;&amp;amp; dataProvider.length==0)&lt;br /&gt;  addToLocalHistory();&lt;br /&gt;_typedText = textInput.text;   // replace typedText with textInput.text&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;I'm not sure if there are any ramifications to this fix but I haven't found any additional problems in my own application.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;UPDATE&lt;br /&gt;&lt;/span&gt;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.&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-8935212492404221126?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/8935212492404221126/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/05/multiple-autocomplete-input-controls-in.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/8935212492404221126'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/8935212492404221126'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/05/multiple-autocomplete-input-controls-in.html' title='Multiple AutoComplete Input Controls in a single Flex Form'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-3451288998211734655</id><published>2008-05-14T07:38:00.001-07:00</published><updated>2008-05-14T08:34:32.885-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><category scheme='http://www.blogger.com/atom/ns#' term='adobe air'/><title type='text'>Running Adobe Air for Linux on Ubuntu</title><content type='html'>If you know what an RIA is then you know what Adobe Air is.  If you don't know what either of them are, then you really shouldn't need to read this post.&lt;br /&gt;&lt;br /&gt;I need to find out what type of performance boost their is running a desktop Flex application as an Adobe Air application compared to running it using FireFox with Flash Player 9.  So in order to do that I need to make sure I can get Adobe Air for Linux ( currently in Alpha ) working. I need to do this because my application needs to run off a linux desktop environment.&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;First download Adobe Air for Linux runtime environment from the following link. You don't need to install the SDK unless you plan on developing Air applications using a linux desktop.  I've started using OSX myself so I'm only going to install the runtime environment.&lt;a href="http://labs.adobe.com/downloads/air_linux.html"&gt;&lt;br /&gt;&lt;br /&gt;http://labs.adobe.com/downloads/air_linux.html&lt;br /&gt;&lt;br /&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;I moved my bin file to /usr/share/air and then changed the permissions.&lt;br /&gt;&lt;pre&gt;sudo mkdir /usr/share/air&lt;br /&gt;sudo mv adobeair_linux_al_******.bin&lt;br /&gt;chmod +x adobeair_linux_al_******.bin&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Then from the desktop go to Places &gt; Computer &gt; usr &gt; share &gt; air  and double click on the bin file.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Follow the prompts and you're done installing the runtime environment.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Now let's see if we can get a fancy Air Application running.  Go to the Sample application section at Adobe Labs and download an application that interests you.  I downloaded Signet which gives you the ability to take your del.icio.us bookmarks to the desktop (whatever that means).&lt;br /&gt;&lt;br /&gt;&lt;a href="http://labs.adobe.com/technologies/air/samples/"&gt;http://labs.adobe.com/technologies/air/samples/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;When you click on the download link you should be presented with the option to open the link with the Adobe Air Application Installer.  Choose OK and follow the prompts. Make sure to select the option to install an icon on your desktop so that the app will be easy to find once installed.&lt;/li&gt;&lt;/ol&gt;There you go. Go and explore the world of Adobe Air applications. Good times.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-3451288998211734655?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/3451288998211734655/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/05/running-adobe-air-for-linux-on-ubuntu.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/3451288998211734655'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/3451288998211734655'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/05/running-adobe-air-for-linux-on-ubuntu.html' title='Running Adobe Air for Linux on Ubuntu'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-4876946723071946294</id><published>2008-05-08T14:36:00.000-07:00</published><updated>2008-05-09T08:39:35.266-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='kiosk'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Setting up a Kiosk Watchdog for your Ubuntu Blackbox Kiosk</title><content type='html'>Previously I put together a post which describes how to build a &lt;a href="http://kerkness.blogspot.com/2008/04/creating-touch-screen-kiosk-using-flex.html"&gt;Kiosk computer using Ubuntu, Blackbox and Firefox&lt;/a&gt;.  I'm following that up with details on how to monitor the kiosk so that you can be notified when/if the computer or services fail.  I'll break this post into two sections.&lt;br /&gt;&lt;br /&gt;1) Monitoring the computer services and network&lt;br /&gt;2) Monitoring FireFox performance&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:180%;"&gt;&lt;span style="font-weight: bold;"&gt;Monitoring the computer services and network&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Because our Kiosk computer is an Ubuntu server and running apache/php/mysql locally there are several open source network and service monitoring programs.  The one I found most suitable for my solution is called &lt;a href="http://www.tildeslash.com/monit/"&gt;Monit&lt;/a&gt; and I found a very good post at &lt;a href="http://www.ubuntugeek.com/monitoring-ubuntu-services-using-monit.html"&gt;Ubuntu Geek&lt;/a&gt; describing how to install monit on ubuntu and configure it.  I basically followed the Ubuntu Geek tutorial but made some modifications to the config file.  My revised process is below.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Install Monit&lt;br /&gt;&lt;pre&gt;sudo apt-get install monit&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;Configure Monit. Open &lt;span style="font-style: italic; font-weight: bold;"&gt;/etc/monit/monitrc&lt;/span&gt; in your favorite text editor.  Below is an example of how I set up my own configuration file. It should be pretty self explanatory.&lt;br /&gt;&lt;pre&gt;## Start monit in background (run as daemon) and check the services at 2-minute&lt;br /&gt;## intervals.&lt;br /&gt;set daemon  120&lt;br /&gt;&lt;br /&gt;## Set syslog logging with the 'daemon' facility.&lt;br /&gt;set logfile syslog facility log_daemon&lt;br /&gt;&lt;br /&gt;## Set list of mailservers for alert delivery.&lt;br /&gt;## I use my ISP's SMTP server for better reliability and means&lt;br /&gt;## I don't need an smtp server running on my Kiosk&lt;br /&gt;set mailserver mail.shawcable.com&lt;br /&gt;&lt;br /&gt;## Use event queue if mailserver unavailable&lt;br /&gt;set eventqueue&lt;br /&gt;basedir /var/monit  # set the base directory where events will be stored&lt;br /&gt;slots 100           # optionaly limit the queue size&lt;br /&gt;&lt;br /&gt;## You can set the alert recipient here&lt;br /&gt;set alert someone@domain.com&lt;br /&gt;&lt;br /&gt;# Monitor Apache&lt;br /&gt;check process apache2 with pidfile /var/run/apache2.pid&lt;br /&gt;&lt;br /&gt;# Action to be taken when apache fails&lt;br /&gt;start program = "/etc/init.d/apache2 start"&lt;br /&gt;stop program = "/etc/init.d/apache2 start"&lt;br /&gt;# Admin will notify by mail if below the condition satisfied below&lt;br /&gt;if cpu is greater than 60% for 2 cycles then alert&lt;br /&gt;if cpu &gt; 60% for 5 cycles then restart&lt;br /&gt;if children &gt; 10 then alert&lt;br /&gt;if children &gt; 50 then restart&lt;br /&gt;if loadavg(5min) greater than 10 for 8 cycles then stop&lt;br /&gt;if 3 restarts within 5 cycles then timeout&lt;br /&gt;group servers&lt;br /&gt;&lt;br /&gt;# Monitor MySQL&lt;br /&gt;check process mysql with pidfile /var/run/mysqld/mysqld.pid&lt;br /&gt;group database&lt;br /&gt;start program = "/etc/init.d/mysql start"&lt;br /&gt;stop program = "/etc/init.d/mysql stop"&lt;br /&gt;if failed host 127.0.0.1 port 3306 then restart&lt;br /&gt;if failed host 127.0.0.1 port 3306 then alert&lt;br /&gt;if 5 restarts within 5 cycles then timeout&lt;br /&gt;&lt;br /&gt;# Monitor SSH Service&lt;br /&gt;check process sshd with pidfile /var/run/sshd.pid&lt;br /&gt;start program = "/etc/init.d/ssh start"&lt;br /&gt;stop program = "/etc/init.d/ssh stop"&lt;br /&gt;if failed port 22 protocol ssh then restart&lt;br /&gt;if failed port 22 protocol ssh then alert&lt;br /&gt;if 5 restarts within 5 cycles then timeout&lt;br /&gt;group programs&lt;br /&gt;&lt;br /&gt;# Check services&lt;br /&gt;check system localhost&lt;br /&gt;if loadavg (1min) &gt; 4 then alert&lt;br /&gt;if loadavg (5min) &gt; 2 then alert&lt;br /&gt;if memory usage &gt; 75% then alert&lt;br /&gt;if cpu usage (user) &gt; 70% then alert&lt;br /&gt;if cpu usage (system) &gt; 80% then alert&lt;br /&gt;if cpu usage (wait) &gt; 20% then alert&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;Set Monit to start automagically.  Open the file &lt;span style="font-style: italic; font-weight: bold;"&gt;/etc/default/monit&lt;/span&gt; and change the &lt;span style="font-style: italic; font-weight: bold;"&gt;startup&lt;/span&gt; value to &lt;span style="font-style: italic; font-weight: bold;"&gt;1&lt;/span&gt;.  You can now start monit with the following command.&lt;br /&gt;&lt;pre&gt;sudo /etc/init.d/monit start&lt;/pre&gt;&lt;/li&gt;&lt;/ol&gt;If you want to be able to access Monit's web based interface remotely then check out the Ubuntu Geek tutorial for more information.  I am not enabling this ability in my kiosk at present.&lt;br /&gt;&lt;span style="font-size:180%;"&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Monitoring FireFox performance&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;By using Monit we are able to get good alerts regarding the overall health of our Kiosk.  But Monit doesn't tell us is how our Kiosk client (Firefox) is behaving. If Firefox starts to eat up a percentage of your kiosk's available memory or CPU power you should be notified early.&lt;br /&gt;&lt;br /&gt;I myself am not that great at building BASH scripts so I opted to create a PHP script which tests a few conditions and sends an email if Firefox isn't running or is using too many resources.  This script can be run as a cron job every few minutes.  My PHP script requires the open source class &lt;a href="http://sourceforge.net/projects/phpmailer"&gt;PHPMailer&lt;/a&gt; which makes sending email from PHP a snap.&lt;br /&gt;&lt;br /&gt;Here is my php script.&lt;br /&gt;&lt;pre&gt; /**&lt;br /&gt;* This script gets the CPU and MEM usage of Firefox&lt;br /&gt;*/&lt;br /&gt;$cpu = 0;&lt;br /&gt;$mem = 0;&lt;br /&gt;$failed = false;&lt;br /&gt;&lt;br /&gt;// Get the PID of firefox&lt;br /&gt;$pid = exec('pidof firefox-bin');&lt;br /&gt;&lt;br /&gt;// If firefox is running get memory&lt;br /&gt;if ( $pid )&lt;br /&gt;{&lt;br /&gt;$status_str = exec('ps aux | grep "'. $pid .'" | grep -v grep');&lt;br /&gt;$status = explode( ' ', $status_str );&lt;br /&gt;// Strip blanks&lt;br /&gt;foreach( $status as $k=&gt;$v )&lt;br /&gt;{&lt;br /&gt;  if ( trim($v) == '' ) unset($status[$k]);&lt;br /&gt;}&lt;br /&gt;$status = array_values($status);&lt;br /&gt;&lt;br /&gt;$cpu = $status[2];&lt;br /&gt;$mem = $status[3];&lt;br /&gt;&lt;br /&gt;if ( $cpu &gt;= 60 || $mem &gt;= 60 )&lt;br /&gt;{&lt;br /&gt;   $failed = true;&lt;br /&gt;   $message = "Firefox is using $cpu% of CPU and $mem% of MEM";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;} else {&lt;br /&gt;&lt;br /&gt;// Firefox is not running&lt;br /&gt;$failed = true;&lt;br /&gt;$message = "Firefox is NOT running";&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;if ( $failed )&lt;br /&gt;{&lt;br /&gt;$body = date('l jS \of F Y h:i:s A',time() )."\n\n";&lt;br /&gt;$body .= $message;&lt;br /&gt;&lt;br /&gt;// Create and Send Email&lt;br /&gt;require_once( "/class/phpmailer/class.phpmailer.php");&lt;br /&gt;&lt;br /&gt;$mail = new PHPMailer();&lt;br /&gt;$mail-&gt;From     = ' firefox@mykiosk ';&lt;br /&gt;$mail-&gt;FromName = " Firefox Status ";&lt;br /&gt;$mail-&gt;Host     = 'mail.shawcable.com';&lt;br /&gt;$mail-&gt;Mailer   = "smtp";&lt;br /&gt;&lt;br /&gt;$mail-&gt;Subject = "Firefox Issue on ArtTouch";&lt;br /&gt;$mail-&gt;AddAddress(" someone@domain.com ");&lt;br /&gt;&lt;br /&gt;$mail-&gt;IsHtml(0);&lt;br /&gt;$mail-&gt;Body    = $body;&lt;br /&gt;&lt;br /&gt;// LOG RESULTS&lt;br /&gt;if(! $mail-&gt;Send() ) {&lt;br /&gt;   error_log("There was an error ending Firefox Performance Alert " . $mail-&gt;ErrorInfo );&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;If anyone wants to turn this into a bash script instead of PHP and share it that would be great.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-4876946723071946294?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/4876946723071946294/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/05/setting-up-kiosk-watchdog-for-your.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/4876946723071946294'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/4876946723071946294'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/05/setting-up-kiosk-watchdog-for-your.html' title='Setting up a Kiosk Watchdog for your Ubuntu Blackbox Kiosk'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-1725016501767033684</id><published>2008-05-07T10:49:00.000-07:00</published><updated>2008-05-08T07:48:40.324-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Accessing Ubuntu Gnome Applications from Mac OSX without using a Remote Desktop</title><content type='html'>99% of the work I do is done on an Ubuntu server but I'm not always using an Ubuntu desktop.  Recently I just bought myself a nice 24" iMac to use as my main workstation.  Most of the time when I need to do something on the Ubuntu server I just open a terminal use ssh.  However sometimes I find this approach a little cumbersome.  When making large edits to config files on the server I find using a terminal based text editor to be a pain in the ass.   Lucky for me there are a few ways to remotely access an Ubuntu desktop.&lt;br /&gt;&lt;br /&gt;The most common approach is to use a VNC client.  For Mac OSX there is a client called  Chicken which seems to be the most popular.  This approach is easy to set up but for me I found it to be dreadfully slow and requires that the user is already logged onto the server.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Using X11 to access Gnome Applications on a Remote Ubuntu Server&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;The process which I've found to suit my needs to a tea, is using the X11 utility which comes with Leopard and can be easily installed in Tiger or Panther.  Here is an example of how to log into a remote Ubuntu server and use &lt;span style="font-style: italic;"&gt;gEdit&lt;/span&gt; to modify a text file. It works really fast and doesn't require a complete remote desktop type solution.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Start up an X11 terminal.  You can find it at  &lt;span style="font-style: italic;"&gt;Applications &gt; Utilities &gt; X11&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Use SSH to log into the remote Ubuntu machine using the &lt;span style="font-style: italic;"&gt;-Y&lt;/span&gt; option&lt;br /&gt;&lt;pre&gt;ssh -Y user@192.168.1.3&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;Use a terminal command to open a file in &lt;span style="font-style: italic;"&gt;gEdit&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;sudo gedit /etc/php5/apache2/php.ini&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;Make changes to the file and close &lt;span style="font-style: italic;"&gt;gEdit&lt;/span&gt; using the menu  &lt;span style="font-style: italic;"&gt;File &gt; Quit&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-weight: bold;"&gt;UPDATE:&lt;br /&gt;&lt;/span&gt;I can confirm that at least with Leopard you don't need to start by opening an X11 terminal. You can log into the remote server using your default OSX &lt;span style="font-style: italic;"&gt;Terminal&lt;/span&gt; as long as you use the &lt;span style="font-style: italic;"&gt;Y&lt;/span&gt; option OSX will automatically start x11 when you try and launch a Gnome application.&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Nice!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-1725016501767033684?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/1725016501767033684/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/05/accessing-ubuntu-gnome-applications.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/1725016501767033684'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/1725016501767033684'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/05/accessing-ubuntu-gnome-applications.html' title='Accessing Ubuntu Gnome Applications from Mac OSX without using a Remote Desktop'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-5095180062180186158</id><published>2008-05-07T08:32:00.000-07:00</published><updated>2008-05-07T08:46:25.498-07:00</updated><title type='text'>Integrating Grand Theft Auto IV with PHP and Flex Applications</title><content type='html'>It can't be done.  I've tried.&lt;br /&gt;&lt;br /&gt;I haven't posted any good tips or code snippets in the past week as I've been a little focused on opening up Manhattan in GTA.  Managing priorities has never really been my problem.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-5095180062180186158?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/5095180062180186158/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/05/integrating-grand-theft-auto-iv-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/5095180062180186158'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/5095180062180186158'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/05/integrating-grand-theft-auto-iv-with.html' title='Integrating Grand Theft Auto IV with PHP and Flex Applications'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-818614976599777388</id><published>2008-04-25T13:07:00.000-07:00</published><updated>2008-04-27T05:01:00.502-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><title type='text'>Getting a performance boost from MySQL</title><content type='html'>I have to admit I am no database guru but I do know how to organize my information into a decent set of tables. Every table has a &lt;span style="font-style: italic;"&gt;primary key&lt;/span&gt; and every field is just large enough and the right type for the data it needs to hold. In general my databases always perform well (enough) and I have little issue.&lt;br /&gt;&lt;br /&gt;Then while reading up on how to properly configure replication with MySQL I stumbled upon some information on &lt;span style="font-style: italic;"&gt;Indexes&lt;/span&gt; and I realized that I wasn't using my database as best I could.&lt;br /&gt;&lt;br /&gt;If you asked me a week ago what an &lt;span style="font-style: italic;"&gt;'Index'&lt;/span&gt; was in relation to a MySQL table I would have told you it was the &lt;span style="font-style: italic;"&gt;'primary key'&lt;/span&gt;.  Which is only partially true. While the &lt;span style="font-style: italic;"&gt;primary key&lt;/span&gt; is automatically used as an &lt;span style="font-style: italic;"&gt;Index&lt;/span&gt; for a table it doesn't have to be the only &lt;span style="font-style: italic;"&gt;Index&lt;/span&gt; for the table.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What is an Index&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;An &lt;span style="font-style: italic;"&gt;Index&lt;/span&gt; is basically a method MySQL (and other databases) use to organize a table to make it easier to search. For example,  because the &lt;span style="font-style: italic;"&gt;primary key&lt;/span&gt; for any table is indexed (and unique) when you search the table for a record matching a &lt;span style="font-style: italic;"&gt;primary key&lt;/span&gt; value, the database knows it only needs to find 1 matching record. If there was no &lt;span style="font-style: italic;"&gt;primary key&lt;/span&gt; the database doesn't know how many possible matches it needs to find so it will have to look at every single record to try and find all possible matches.&lt;br /&gt;&lt;br /&gt;Knowing this, if you create &lt;span style="font-style: italic;"&gt;Indexes&lt;/span&gt; for your table on all fields which are frequently searched or are used in &lt;span style="font-style: italic;"&gt;Join&lt;/span&gt; statements you'll help your database find records more easily.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;An Example&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I typically use a lot of joins when I query the database. Let's look at how one of these join queries perform without any &lt;span style="font-style: italic;"&gt;Indexing&lt;/span&gt; ( apart from the default indexing of my &lt;span style="font-style: italic;"&gt;primary keys&lt;/span&gt; ).&lt;br /&gt;&lt;br /&gt;In my database there is a table called 'artist' which contains the names, biography and details on different artists. The artist table has a &lt;span style="font-style: italic;"&gt;primary key&lt;/span&gt; field call artistid. In the same database there is another table called artwork which contains details on individual pieces of art.  The artwork table has a &lt;span style="font-style: italic;"&gt;primary key&lt;/span&gt; field called artid, but it also contains its own artistid field. The artist and artwork tables have a one-to-many relationship, meaning that a single artist can have many works of art.&lt;br /&gt;&lt;br /&gt;Using this database design, you can load a complete listing of works of art by a single artist with the following query.&lt;br /&gt;&lt;pre&gt;SELECT artwork.*, artist.* FROM artwork&lt;br /&gt; LEFT JOIN artist ON artwork.artistid=artist.artistid WHERE artwork.artistid=46;&lt;/pre&gt;This query will work just fine. However if we want to gain some insight into how much information MySQL needs to process to perform this query we can add the EXPLAIN declaration to the front of the query.&lt;br /&gt;&lt;pre&gt;EXPLAIN SELECT artwork.*, artist.* FROM artwork&lt;br /&gt; LEFT JOIN artist ON artwork.artistid=artist.artistid WHERE artwork.artistid=46;&lt;/pre&gt;When we run this query at the command prompt MySQL gives the following response.&lt;br /&gt;&lt;pre&gt;+----+-------------+---------+-------+---------------+----------+---------+-------+------+-------------+&lt;br /&gt;| id | select_type | table   | type  | possible_keys | key      | key_len | ref   | rows | Extra       |&lt;br /&gt;+----+-------------+---------+-------+---------------+----------+---------+-------+------+-------------+&lt;br /&gt;|  1 | SIMPLE      | artwork | ALL   | NULL          | NULL     | NULL    | NULL  | 3106 | Using where |&lt;br /&gt;|  1 | SIMPLE      | artist  | const | artistid      | artistid | 4       | const |    1 |             |&lt;br /&gt;+----+-------------+---------+-------+---------------+----------+---------+-------+------+-------------+&lt;/pre&gt;This tells us that when looking up information from the artist table the database was able to use the &lt;span style="font-style: italic;"&gt;primary key&lt;/span&gt; index and looked at a total of 1 rows in the table in order to find the information it needed. That seems pretty efficient. However when looking in the artwork table the database had do a full table scan and looked at 3106 rows to find matching records.&lt;br /&gt;&lt;br /&gt;Let's see what happens when we add an &lt;span style="font-style: italic;"&gt;Index&lt;/span&gt; on artistid to the artwork table.&lt;br /&gt;&lt;pre&gt;ALTER TABLE artwork ADD INDEX( artistid );&lt;/pre&gt;Now when we run the same EXPLAIN query we get the following details from MySQL&lt;br /&gt;&lt;pre&gt;+----+-------------+---------+-------+---------------+----------+---------+-------+------+-------------+&lt;br /&gt;| id | select_type | table   | type  | possible_keys | key      | key_len | ref   | rows | Extra       |&lt;br /&gt;+----+-------------+---------+-------+---------------+----------+---------+-------+------+-------------+&lt;br /&gt;|  1 | SIMPLE      | artwork | ref   | artistid      | artistid | 5       | const |    4 | Using where |&lt;br /&gt;|  1 | SIMPLE      | artist  | const | artistid      | artistid | 4       | const |    1 |             |&lt;br /&gt;+----+-------------+---------+-------+---------------+----------+---------+-------+------+-------------+&lt;/pre&gt;Now doesn't that look much more efficient.  This time because the database is keeping an &lt;span style="font-style: italic;"&gt;Index&lt;/span&gt; on the artistid field in both tables.  It only needed to look at 4 rows from the artwork table to find the matching results.&lt;br /&gt;&lt;br /&gt;I did some additional performance testing to see how much of a boost adding this one extra &lt;span style="font-style: italic;"&gt;Index&lt;/span&gt; provided during peak times of database use.  Prior to the indexing the query on average took 0.06 seconds, after the indexing it took 0.00. That's just on one tiny little query on a database that has only 3000 records. If you start adding extra indexes to all the tables in your database you should notice a nice boost in speed and performance.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-818614976599777388?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/818614976599777388/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/04/getting-performance-boost-from-mysql.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/818614976599777388'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/818614976599777388'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/04/getting-performance-boost-from-mysql.html' title='Getting a performance boost from MySQL'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-721632602069700838</id><published>2008-04-19T07:59:00.001-07:00</published><updated>2008-04-19T08:24:15.478-07:00</updated><title type='text'>Flex Tip: Publicly Accessible Private Variables in a Flex Class Or Another Reason to use Getters and Setters</title><content type='html'>I've really fallen in love with using Getters and Setters for requesting and updating variable values in my flex classes. The most obvious reason for using Getters and Setters is having the ability to run some logic each time the value of a variable is updated or requested.&lt;br /&gt;&lt;br /&gt;Another elegant reason to use Getters and Setters which I've just stumbled upon is the ability to have a variable which is bindable and can be accessed publicly but can only be modified privately. I'll let you come up with your own reasons why this is useful. For me I wanted a custom component to be responsible for managing it's own state but needed the ability for other components to determine it's current state.&lt;br /&gt;&lt;br /&gt;Here's an example of how you might be used to working with variables. You have one variable which can be accessed or updated publicly and another which is just for internal use.&lt;br /&gt;&lt;pre&gt;// a publicly accessible variable with binding&lt;br /&gt;[Bindable] public var currentState:String;&lt;br /&gt;// a private variable&lt;br /&gt;private var internalState:String;&lt;br /&gt;&lt;br /&gt;// You could use a private function to update both variables.&lt;br /&gt;private function updateCurrentState(value:String):void&lt;br /&gt;{&lt;br /&gt;  this.currentState = value;&lt;br /&gt;  this.internalState = value;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;The above code would work to meet my requirements but it's an obviously flawed and confusing approach. However without using Getters or Setters it would be the easiest way to meet the requirements.&lt;br /&gt;&lt;br /&gt;Here is how you can use Setters and Getters which let you use one variable that can be accessed publicly but only updated internally.  Just use a public scope declaration on the &lt;span style="font-style: italic;"&gt;get&lt;/span&gt; function and a private scope declaration on the &lt;span style="font-style: italic;"&gt;set&lt;/span&gt; function. Easy and elegant.&lt;br /&gt;&lt;pre&gt;private var _currentState:String;&lt;br /&gt;&lt;br /&gt;[Bindable] public function get currentState():String&lt;br /&gt;{&lt;br /&gt;  return this._currentState;&lt;br /&gt;}&lt;br /&gt;private function set currentState(value:String):void&lt;br /&gt;{&lt;br /&gt;  this._currentState = value;&lt;br /&gt;}&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-721632602069700838?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/721632602069700838/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/04/flex-tip-publicly-accessible-private.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/721632602069700838'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/721632602069700838'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/04/flex-tip-publicly-accessible-private.html' title='Flex Tip: Publicly Accessible Private Variables in a Flex Class Or Another Reason to use Getters and Setters'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-3143933692368039534</id><published>2008-04-17T12:40:00.000-07:00</published><updated>2008-04-17T12:55:19.439-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='php-to-flex'/><title type='text'>PHP explode() function in Actionscript for Flex</title><content type='html'>If you're a long time PHP programmer who has made the leap to building Flex based RIA applications in Flex you are probably asking yourself from time to time "how do I do a xxxxx function in actionscript".   Well if you were recently wondering this about the PHP explode() function, here's your answer.&lt;br /&gt;&lt;pre&gt;public function explode( delimiter:String, str:String ):Array&lt;br /&gt;{&lt;br /&gt; return str.split( delimiter );&lt;br /&gt;}&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-3143933692368039534?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/3143933692368039534/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/04/php-explode-function-in-actionscript.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/3143933692368039534'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/3143933692368039534'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/04/php-explode-function-in-actionscript.html' title='PHP explode() function in Actionscript for Flex'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-8890645319960077056</id><published>2008-04-17T11:15:00.000-07:00</published><updated>2008-04-19T06:38:24.790-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><title type='text'>warning: unable to bind to property 'XX' on class 'Object' (class is not an IEventDispatcher)</title><content type='html'>&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;/span&gt;When working with data pulled in from an HTTPService in Flex you may find that at run time your application spits out a bunch of warnings that it is unable to bind to a property.&lt;br /&gt;&lt;br /&gt;If you want to prevent these warnings from occuring you should process your the data for your in actionscript instead of MXML.&lt;br /&gt;&lt;br /&gt;Change this ...&lt;br /&gt;&lt;pre&gt;&amp;lt;mx:Label text="{myresults.dynamiclabel}"/&amp;gt;&lt;/pre&gt;To this ... ( calling the function init() with the creationComplete event )&lt;br /&gt;&lt;pre&gt;&amp;lt;mx:Script&amp;gt;&lt;br /&gt;[Bindable] private var dynamiclabel:String;&lt;br /&gt;private function init():void&lt;br /&gt;{&lt;br /&gt; this.dynamiclabel = myresults.dynamiclabel;&lt;br /&gt;}&lt;br /&gt;&amp;lt;/mx:Script&amp;gt;&lt;br /&gt;&amp;lt;mx:Label text="{this.dynamiclabel}"/&amp;gt;&lt;/pre&gt;I know this approach requires a little bit more code and the first approach works, but this way it doesn't result in any warnings. I'll make the assumption that no run-time warnings means more compliant code.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Another approach to solving the problem&lt;/span&gt; is by wrapping Arrays in ArrayCollection and Objects in ObjectProxy wrappers.  I got the following example &lt;a href="http://livedocs.adobe.com/flex/2/langref/flash/events/IEventDispatcher.html"&gt;from here&lt;/a&gt;.&lt;br /&gt;&lt;pre&gt;function resultHandler(result:Array)&lt;br /&gt;{&lt;br /&gt;for(var i:String in result)&lt;br /&gt;  {result[i] = new ObjectProxy(result[i]);}&lt;br /&gt;targetArrayCollection = new ArrayCollection(result);&lt;br /&gt;}&lt;/pre&gt;&lt;span style="font-weight: bold;"&gt;What about using ItemRenderer(s)?&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;If you are combining the use of an &lt;span style="font-style: italic;"&gt;ItemRenderer&lt;/span&gt; and data from an &lt;span style="font-style: italic;"&gt;HTTPService&lt;/span&gt; in your application you may find that neither of the above solutions fully work. What you really need is a modification of the first solution. Collecting your data in response to the &lt;span style="font-style: italic;"&gt;creationComplete&lt;/span&gt; event will only collect data when the &lt;span style="font-style: italic;"&gt;itemRenderer&lt;/span&gt; is first created. The event is not called when dynamically change the &lt;span style="font-style: italic;"&gt;dataProvider.&lt;/span&gt;  An approach to solving this scenario is the create a &lt;span style="font-style: italic;"&gt;ChangeWatcher&lt;/span&gt; in the &lt;span style="font-style: italic;"&gt;ItemRenderer&lt;/span&gt; to respond to changes to the &lt;span style="font-style: italic;"&gt;data&lt;/span&gt; property of said &lt;span style="font-style: italic;"&gt;ItemRenderer.&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&amp;lt;mx:Script&amp;gt;&lt;br /&gt;import mx.binding.utils.ChangeWatcher;&lt;br /&gt;import mx.events.PropertyChangeEvent;&lt;br /&gt;&lt;br /&gt;private var dataWatcher:ChangeWatcher;&lt;br /&gt;&lt;br /&gt;[Bindable] private var dynamiclabel:String;&lt;br /&gt;&lt;br /&gt;// ** Call this function from creationComplete event **&lt;br /&gt;private function init():void&lt;br /&gt;{&lt;br /&gt;   this.dataWatcher = ChangeWatcher.watch( this, 'data', dataChangeHandler );&lt;br /&gt;   this.dataChangeHandler(); &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private function dataChangeHandler(event:Event=null):void&lt;br /&gt;{&lt;br /&gt;   this.dynamiclabel = data.dynamiclabel;&lt;br /&gt;}&lt;br /&gt;&amp;lt;/mx:Script&amp;gt;&lt;br /&gt;&amp;lt;mx:Label text="{this.dynamiclabel}"/&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-8890645319960077056?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/8890645319960077056/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/04/warning-unable-to-bind-to-property-xx.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/8890645319960077056'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/8890645319960077056'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/04/warning-unable-to-bind-to-property-xx.html' title='warning: unable to bind to property &apos;XX&apos; on class &apos;Object&apos; (class is not an IEventDispatcher)'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-5322089790080505487</id><published>2008-04-16T12:12:00.001-07:00</published><updated>2008-04-16T12:42:04.187-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Upgrading to FlexBuilder Linux Alpha 3 on Ubuntu 7.10 after Flexbuilder Alpha 2 expires</title><content type='html'>This post is probably a month overdue but I've been working on a Mac OSX workstation for the last month ( my Dad has a nice new Mac so while he was on vacation I used his computer ). Anyway, my dad came back so I moved back to my trusty Ubuntu workstation at my own desk. To my surprise the Alpha version of the Adobe Flex Builder Linux had expired. I have licensed copies for Flex Builder for both Windows and Mac but there is no release for Linux yet so I'm left using alpha versions.&lt;br /&gt;&lt;br /&gt;The good news is that if your copy of Flex Builder Alpha 2 has expired (which I think everyone's did on March 15th) all you need to do is uninstall Flex Builder Alpha 2 and install Flex Builder Alpha 3.  There are some new requirements however which makes this process a little more complicated if you're running Ubuntu. Mainly, Flex Builder Alpha 3 requires Eclipse 3.3  and the version of Eclipse which can be installed from Ubuntu repository is only version 3.2&lt;br /&gt;&lt;br /&gt;So here are the steps you need to follow if you want to get Flex Builder Alpha 3 installed on Ubuntu after Flex Builder Alpha 2 has expired.  Instead of writing a full howto I'm going to link you to the different blogs/pages which have the instructions you'll need.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;(Optional) If you haven't already upgraded to Ubuntu 7.10 now would be a good time.  I was running Fiesty Fawn (which is 7.04 I think). &lt;a href="http://www.ubuntu.com/getubuntu/upgrading"&gt;View this link to get that done.&lt;br /&gt;&lt;br /&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Next you need to install Eclipse 3.3 on your system. &lt;a href="http://portal.chrost.com/index.php?view=article&amp;amp;id=5%3Arunning-eclipse-33-on-ubuntu-710-gutsy-gibbon&amp;amp;option=com_content&amp;amp;Itemid=17"&gt;Follow the instructions at this link&lt;/a&gt; but be insure to install 3.3 to a different location than 3.2.  After you have 3.3 running you can copy the contents to the eclipse folder to the location where you have 3.2 installed.  Mine was located at  ~/.eclipse&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Before installing Flex Builder Alpha 3 you'll need to uninstall Flex Builder Alpha 2.  To do this you need to run the script Uninstall_Adobe_Flex_Builder_Linux. This will be located in the directory Uninstall Adobe_Flex_Builder_Linux which in turn exists in the Flex Builder Linux installation directory. &lt;a href="http://labs.adobe.com/technologies/flex/flexbuilder_linux/releasenotes.html#install"&gt; For full details see the Uninstall section of the release notes for alpha 3&lt;/a&gt;.&lt;br /&gt;&lt;a href="http://labs.adobe.com/downloads/flexbuilder_linux.html"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://labs.adobe.com/downloads/flexbuilder_linux.html"&gt;Download Flex Builder Alpha 3&lt;br /&gt;&lt;br /&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Open your terminal and run the downloaded .bin file.  For me I typed the following.&lt;br /&gt;&lt;pre&gt;cd /home/ryan/Desktop&lt;br /&gt;sh flexbuilder_linux_install_a3_033108.bin&lt;/pre&gt;Follow the onscreen instructions.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;When finished you should be able to fire up Alpha 3.  You may find that you get an error when opening older project files saying that the file is out of sync.  Just right-click on the project and select the 'Refresh' option.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;If you need to add a launcher for the Flex Builder Alpha 3 program, the default location of the command to launch the program is&lt;br /&gt;&lt;pre&gt;/home/ryan/Adobe_Flex_Builder_Linux/Adobe_Flex_builder.sh&lt;/pre&gt;Assuming of course that you're user name is 'ryan' like mine is.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-5322089790080505487?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/5322089790080505487/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/04/upgrading-to-flexbuilder-linux-alpha-3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/5322089790080505487'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/5322089790080505487'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/04/upgrading-to-flexbuilder-linux-alpha-3.html' title='Upgrading to FlexBuilder Linux Alpha 3 on Ubuntu 7.10 after Flexbuilder Alpha 2 expires'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-5974490873743585986</id><published>2008-04-13T19:07:00.000-07:00</published><updated>2008-04-15T14:34:54.758-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Setting up a PHP IDE for Ubuntu 7.10</title><content type='html'>I'm just posting this so that I have a record of it. I found myself building a new workstation at home and found this info scattered across several blogs when I looked for a refresher on setting up everything I normally use.&lt;br /&gt;&lt;br /&gt;First step. Install Eclipse.&lt;br /&gt;&lt;pre&gt;sudo apt-get install eclipse&lt;br /&gt;sudo apt-get install sun-java6-jre&lt;br /&gt;sudo update-java-alternatives -s java-6-sun&lt;/pre&gt;&lt;br /&gt;Next install PHPEclipse. you can go to Help &gt; Software Updates &gt; Find and Install and install new features located at the following URL&lt;br /&gt;&lt;pre&gt;http://phpeclipse.sourceforge.net/update/releases&lt;/pre&gt;&lt;br /&gt;Finally. Install the RSE (remote system explorer) Plug In so you can easily access a remote Unix server and edit files willy-nilly.  Note you don't need to install everything in the TM project.&lt;br /&gt;&lt;pre&gt;http://download.eclipse.org/dsdp/tm/updates/&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-5974490873743585986?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/5974490873743585986/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/04/installing-eclipse-on-ubuntu-710.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/5974490873743585986'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/5974490873743585986'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/04/installing-eclipse-on-ubuntu-710.html' title='Setting up a PHP IDE for Ubuntu 7.10'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-9112417894027080011</id><published>2008-04-09T11:15:00.001-07:00</published><updated>2008-04-17T12:56:10.577-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='kiosk'/><category scheme='http://www.blogger.com/atom/ns#' term='blackbox'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Creating a Touch Screen Kiosk using Firefox, Ubuntu and Blackbox</title><content type='html'>Several of the components and posts on this web site have revolved around a business project I've been working on which involves creating a touch screen kiosk for use in a public space.  I thought it might be beneficial (at least from my own documenting needs) to provide a post covering the overall process of getting a secure touch screen system up running.&lt;br /&gt;&lt;br /&gt;The easiest way to build a kiosk application is to customize a web page to serve as the kiosk interface. Launch the web page in a browser and set the browser to run in full screen mode and voila, instant kiosk.  To turn it into a touch screen kiosk all you need to do is buy an &lt;a href="http://www.google.ca/search?q=touchscreen+lcd"&gt;LCD touch screen monitor&lt;/a&gt; and your all set.&lt;br /&gt;&lt;br /&gt;This basic solution might work fine if you're always standing next to the computer and can enable full screen mode every time it reboots and also stop anyone from mucking around with your computer should the browser crash and they get access to the desktop.&lt;br /&gt;&lt;br /&gt;Setting up a kiosk which can run in a public space and have reasonable enough security to prevent someone from mucking around with it should the browser crash or computer crash takes a little more thought.&lt;br /&gt;&lt;br /&gt;I've addressed the overall solution in two parts.&lt;br /&gt;&lt;br /&gt;1) The server/host computer&lt;br /&gt;2) The browser&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;span style="font-size:180%;"&gt;1) The Server / Host Computer&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;The computer used to host a touch screen application needs some thoughtful consideration. You want something that will offer good reliable performance and also prevent anyone who might be feeling a little malicious from causing the computer or your application any harm. My touch screen system does NOT have a keyboard attached to it which certainly helps in providing a certain level of security but I still need to take steps to make sure the user cannot get access to the desktop, general file system or any application other than the Firefox browser.&lt;br /&gt;&lt;br /&gt;For my solution I decided to run Ubuntu 7.10 and use Blackbox as the default desktop environment.  Ubuntu allows me to run an apache http server as well as mysql locally. This keeps the application running very fast, provides me with dynamic data and requires no internet connection. Your kiosk application could be simple straight HTML running locally or running off a remote web server whatever suits your needs.  Using Ubuntu (or really any flavor of linux you're comfortable with) keeps your kiosk highly customizable.&lt;br /&gt;&lt;br /&gt;Using the Blackbox windows manager instead of the default Gnome or KDE desktop environment allows me to lockout the user from accessing anything other than Firefox and keeps your kiosk as a light weight, fast computer with a single focus.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How to set up the server/host computer&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Download and install Ubuntu 7.10&lt;/span&gt;&lt;br /&gt;A default install is fine. The main user you will create during install will be considered a super user. You'll later create a user account specifically for accessing the touch screen application. &lt;a href="http://www.ubuntu.net/getubuntu/download"&gt;Click here to get Ubuntu&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Install Apache, PHP5 and MySQL (Optional)&lt;/span&gt;&lt;br /&gt;My specific application uses dynamic data and requires both Apache and PHP. Using an Ubuntu computer makes it easy to run these services locally and means my computer doesn't require a dedicated internet connection. Although having one makes remote administration and updates easier. &lt;a href="http://ubuntuguide.org/wiki/Ubuntu:Gutsy#How_to_install_Apache_and_PHP5"&gt;To install these on the computer just reference the UbuntuGuide.org wiki&lt;br /&gt;&lt;br /&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Create a limited user account&lt;/span&gt;&lt;br /&gt;While your touch screen application is running you'll want to have a limited user account logged into the computer.&lt;br /&gt;&lt;br /&gt;To create this account log into Ubuntu using the account you created during install and select :&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;System &gt; Administration &gt; Users and Groups&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;From the &lt;span style="font-style: italic;"&gt;User settings&lt;/span&gt; window select:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Add User&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;From the &lt;span style="font-style: italic;"&gt;New User Account&lt;/span&gt; window fill in the &lt;span style="font-style: italic;"&gt;Basic Settings&lt;/span&gt; for your user. For the purpose of this example we will use the username: &lt;span style="font-weight: bold;"&gt;touchuser&lt;/span&gt;. After you've provided a user name and and password select the &lt;span style="font-style: italic;"&gt;User Privileges&lt;/span&gt; tab.  Unselect all options which are not a requirement of your touch screen application. For my application I blocked access to all external hard drives, cdroms, floppies and log monitors.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Install Blackbox Window Manager&lt;/span&gt;&lt;br /&gt;Blackbox is a fast, lightweight and minimal windows manager for the X Window System.  &lt;a href="http://blackboxwm.sourceforge.net/AboutBlackbox"&gt;You can learn more about it here&lt;/a&gt;. Blackbox will be setup as the default desktop for our host computer.  I use Blackbox because it helps prevent the touch screen user from having access to any applications unless they are specifically enabled via Blackbox.&lt;br /&gt;&lt;br /&gt;To install blackbox open up the terminal and type the following command.&lt;br /&gt;&lt;pre&gt;sudo apt-get install blackbox blackbox-themes&lt;/pre&gt;Next we need to create a .blackboxrc file and a .blackbox directory. These will be used to define our configuration settings for our desktop and define what applications touchuser has access to. Note: we are going to do this in the home directory of the touchuser account not the account we are logged in as. After we create the file and directory we set permissions on them.&lt;br /&gt;&lt;pre&gt;sudo mkdir /home/touchuser/.blackbox&lt;br /&gt;sudo touch /home/touchuser/.blackboxrc&lt;br /&gt;sudo chown touchuser /home/touchuser/.blackbox&lt;br /&gt;sudo chown touchuser /home/touchuser/.blackboxrc&lt;br /&gt;sudo chgrp touchuser /home/touchuser/.blackbox&lt;br /&gt;sudo chgrp touchuser /home/touchuser/.blackboxrc&lt;br /&gt;&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Define the .blackboxrc File&lt;/span&gt;&lt;br /&gt;Using your favorite text editor add the following definitions to the .blackboxrc file.  Note the reference to &lt;span style="font-style: italic;"&gt;/home/touchuser/.blackbox/menu&lt;/span&gt;. This file will be created in the next step.&lt;/li&gt;&lt;pre&gt;session.styleFile: /usr/share/blackbox/styles/Gray&lt;br /&gt;session.menuFile: /home/touchuser/.blackbox/menu&lt;br /&gt;session.screen0.workspaces: 1&lt;br /&gt;session.screen0.workspaceNames: My Touch Screen&lt;br /&gt;session.fullMaximization: True&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;NOTE:&lt;/span&gt; If you decide to run Blackbox now you may find yourself unable to complete the rest of the steps in this tutorial. All the steps for setting up the host computer assume you are logged into Ubuntu using the user created during install and running a Gnome session. If you're logged into Blackbox press CTRL + ALT + BACKSPACE to return to the Ubuntu login screen. You can select the 'options' button to change what windows manager is used when you log in.&lt;br /&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Create the Blackbox menu file&lt;/span&gt;&lt;br /&gt;By default the Blackbox desktop provides no icons. To launch a program the user needs to right-click on the desktop to see a menu of available applications.  We want to provide our own menu settings so that the only application available to our user is Firefox. This is really only of limited use as right-clicking on a touch screen is impossible as far as I know, but in case someone figures out how to do it we don't want them to have access to anything other than the browser.&lt;br /&gt;&lt;br /&gt;Enter the following commands into the terminal to create the menu file and set appropriate permissions.&lt;br /&gt;&lt;pre&gt;sudo touch /home/touchuser/.blackbox/menu&lt;br /&gt;sudo chgrp touchuser /home/touchuser/.blackbox/menu&lt;br /&gt;sudo chown touchuser /home/touchuser/.blackbox/menu&lt;/pre&gt;To limit our menu to only provide access to Firefox open up the menu file and add the following.&lt;br /&gt;&lt;pre&gt;[begin] (ArtTouch)&lt;br /&gt;[exec] (firefox) {firefox}&lt;br /&gt;[end]&lt;/pre&gt;For more details on configuring blackbox and creating menus &lt;a href="http://blackboxwm.sourceforge.net/"&gt;see the blackbox wiki&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Install iDesk&lt;/span&gt;&lt;br /&gt;Blackbox doesn't by default support desktop icons which is okay since we are building a minimal system. Well what if the Firefox browser crashes and the touch screen user is left starting at an empty desktop with no ability to right-click and relaunch the browser.  To provide a solution to this problem we are going to install iDesk which adds icon support to minimal window managers such as Blackbox.&lt;br /&gt;&lt;br /&gt;To install iDesk open a terminal and provide the following command&lt;br /&gt;&lt;pre&gt;sudo apt-get install idesk&lt;/pre&gt;Once iDesk is installed we need to create an .ideskrc file for configuration settings and create an .idesktop folder where we can define our icons.&lt;br /&gt;&lt;pre&gt;sudo touch /home/touchuser/.ideskrc&lt;br /&gt;sudo mkdir /home/touchuser/.idesktop&lt;br /&gt;sudo chgrp touchuser /home/touchuser/.ideskrc&lt;br /&gt;sudo chgrp touchuser /home/touchuser/.idesktop&lt;br /&gt;sudo chown touchuser /home/touchuser/.ideskrc&lt;br /&gt;sudo chown touchuser /home/touchuser/.idesktop&lt;br /&gt;&lt;/pre&gt;Next open up the .ideskrc file and add the following&lt;br /&gt;&lt;pre&gt;table Config&lt;br /&gt;Background.Color: #C2CCFF&lt;br /&gt;end&lt;br /&gt;table Actions&lt;br /&gt;Execute[0]: left singleClk&lt;br /&gt;end&lt;/pre&gt;This is a very minimal use of iDesk configuration options for more see the &lt;a href="http://idesk.sourceforge.net/wiki/index.php/Idesk-usage"&gt;iDesk Usage Wiki&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Create an Icon and define icon commands&lt;/span&gt;&lt;br /&gt;Next we need to create an icon for our desktop. You could use the standard Firefox icon but you're probably best to create a PNG specifically for your touch screen application.  Create a PNG file (for example touchicon.png) and stick it in the .idesktop directory.  To add the icon to the desktop we need to create a file with a .lnk extension and place it in the .desktop directory also.&lt;br /&gt;&lt;pre&gt;sudo touch /home/touchuser/.idesktop/touchicon.lnk&lt;br /&gt;sudo chown touchuser /home/touchuser/.idesktop/touchicon.lnk&lt;br /&gt;sudo chgrp touchuser /home/touchuser/.idesktop/touchicon.lnk&lt;/pre&gt;Open the touchicon.lnk file and add the following. Adjust 'caption', 'tooltip', 'width', 'height' and 'x/y' coordinates to suit your needs.&lt;br /&gt;&lt;pre&gt;table Icon&lt;br /&gt;Caption: Touch Application&lt;br /&gt;ToolTip.Caption: Touch Me To Launch&lt;br /&gt;Command: firefox&lt;br /&gt;Icon: /home/touchuser/.idesktop/touchicon.png&lt;br /&gt;Width: 400&lt;br /&gt;Height: 275&lt;br /&gt;X: 100&lt;br /&gt;Y: 100&lt;br /&gt;end&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Create Blackbox startup script&lt;/span&gt;&lt;br /&gt;Now that we have a minimal desktop and we also have an icon for our desktop we need to make sure that iDesk is automatically run when Blackbox runs (by default it doesn't).  To do this we are going to create a startup script for Blackbox.&lt;br /&gt;&lt;br /&gt;Create a file called &lt;span style="font-style: italic;"&gt;.bbstartup.sh&lt;/span&gt; in your touchuser's home directory&lt;br /&gt;&lt;pre&gt;sudo touch /home/touchuser/.bbstartup.sh&lt;br /&gt;sudo chgrp touchuser /home/touchuser/.bbstartup.sh&lt;br /&gt;sudo chown touchuser /home/touchuser/.bbstartup.sh&lt;br /&gt;sudo chmod x+ /home/touchuser/.bbstartup.sh&lt;/pre&gt;Add the following to the &lt;span style="font-style: italic;"&gt;.bbstartup.sh&lt;/span&gt; file&lt;br /&gt;&lt;pre&gt;#!/bin/sh&lt;br /&gt;idesk &amp;amp;&lt;br /&gt;exec blackbox&lt;/pre&gt;Now we need to change the path of exec blackbox in &lt;span style="font-style: italic;"&gt;/usr/share/xsessions/blackbox.desktop&lt;/span&gt;. Start by making a backup&lt;br /&gt;&lt;pre&gt;sudo cp /usr/share/xsessions/blackbox.desktop /usr/share/xsessions/blackbox.desktop_backup&lt;/pre&gt;Edit &lt;span style="font-style: italic;"&gt;/usr/share/xsessions/blackbox.desktop&lt;/span&gt; and make the following changes to &lt;span style="font-style: italic;"&gt;Exec&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;TryExec&lt;/span&gt; definitions&lt;br /&gt;&lt;pre&gt;[Desktop Entry]&lt;br /&gt;Encoding=UTF-8&lt;br /&gt;Name=BlackBox&lt;br /&gt;Comment=Highly configurable and low resource X11 Window manager&lt;br /&gt;Exec=&lt;b&gt;/home/touchuser/.bbstartup.sh&lt;/b&gt;&lt;br /&gt;Terminal=False&lt;br /&gt;TryExec=&lt;b&gt;/home/touchuser/.bbstartup.sh&lt;/b&gt;&lt;br /&gt;Type=Application&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Set Auto-login and define Blackbox as default window manager&lt;/span&gt;&lt;br /&gt;The final step in configuring our server/host computer is to set up Ubuntu to automatically log into our touchuser profile and to use Blackbox as the default windows manager.  This ensures that if the computer crashes or reboots that it immediately goes into kiosk mode. (note we'll further improve this by making the browser automatically launch later).&lt;br /&gt;&lt;br /&gt;Open the Login Window Preferences by selecting:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;System &gt; Administration &gt; Login Window&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Under the &lt;span style="font-style: italic;"&gt;General&lt;/span&gt; tab select &lt;span style="font-style: italic;"&gt;'Blackbox'&lt;/span&gt; for default session.&lt;br /&gt;Under the &lt;span style="font-style: italic;"&gt;Security&lt;/span&gt; tab select &lt;span style="font-style: italic;"&gt;'Enable automatic login'&lt;/span&gt; and select the user &lt;span style="font-style: italic;"&gt;'touchuser'&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;Hopefully after all that you should now have a basic set up to run a kiosk. When the computer boots it should load directly to a Blackbox desktop that allows the user to launch Firefox and only Firefox. In the next step of the process we are going to modify a few settings in Firefox to make sure it loads our touch screen application as it's homepage and automatically launches in full screen mode when the computer boots up.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;NOTE:&lt;/span&gt;&lt;/span&gt;  If the computer is running in kiosk mode and you want to be able to login as your super user and get back to a fully functional Gnome desktop all you need to do is plug in a keyboard and press &lt;span style="font-weight: bold; font-style: italic;"&gt;CTRL + ALT + BACKSPACE&lt;/span&gt;.   This will kill the Blackbox session and bring you to the Ubuntu login screen.&lt;a href="http://idesk.sourceforge.net/wiki/index.php/Main_Page"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:180%;"&gt;&lt;span style="font-weight: bold;"&gt;2) The Browser&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Now that we have our host computer set up and running we'll want to make a few small changes to the preferences of our Firefox browser so that it performs well as a kiosk client.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Set the Home Page&lt;/span&gt;&lt;br /&gt;This should be pretty obvious.  When the browser launches we want it to automatically load our Kiosk application. For my solution I have the Kiosk application running locally as a Flex/PHP application.  Your kiosk doesn't have to be Flex, it could be a Flash or simple HTML web page and it could be running remotely or locally. Whatever the case may be you'll want to set the URL location of your application as the homepage for Firefox.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Disabling session restore&lt;/span&gt;&lt;br /&gt;When Firefox crashes or the computer is shutdown before closing the browser, Firefox will by default ask if you want to restore your previous session or start a new one the next time it launches. This is kind of a pointless feature for the kiosk as you'll likely always want it to start a new session.  You can disable this feature by logging into your kiosk as 'touchuser' launching Firefox and entering &lt;span style="font-weight: bold; font-style: italic;"&gt;'about:config' &lt;/span&gt;in address bar.&lt;br /&gt;&lt;br /&gt;Find the preference settings for  &lt;span style="font-style: italic;"&gt;browser.sessionstore.resume_from_crash&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;browser.sessionstore.resume_session_once&lt;/span&gt; and set their values to &lt;span style="font-weight: bold; font-style: italic;"&gt;false&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Getting the browser to automatically launch in fullscreen mode.&lt;/span&gt;&lt;br /&gt;When the browser is launched in order to provide a true kiosk type environment we want it to load in full screen mode giving the user no access to the navigation bar and locked out of most shortcuts. The easiest way to do this is to install one of the many '&lt;a href="https://addons.mozilla.org/en-US/firefox/search?q=Full+Screen&amp;amp;cat=all"&gt;Full Screen&lt;/a&gt;' extensions available for Firefox.&lt;br /&gt;&lt;br /&gt;The one I recommend is &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/1659"&gt;R-Kiosk.&lt;/a&gt; For the pure purpose of running a web based Kiosk it does a very good job. While logged in as 'touchuser' &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/1659"&gt;Visit this link in Firefox&lt;/a&gt; and click the '&lt;span style="font-weight: bold; font-style: italic;"&gt;Add To Firefox&lt;/span&gt;' button.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;NOTE:&lt;/span&gt;  After this component is added to Firefox you'll be unable to make any preference or configuration changes to Firefox unless you launch it in safe mode.  For information on how to run Firefox in safe mode, &lt;a href="http://kb.mozillazine.org/Safe_Mode_%28Firefox%29"&gt;visit this link&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Setting the browser to automatically launch after boot&lt;/span&gt;&lt;br /&gt;When our kiosk system is booted it will automatically login as with the touchuser profile and load our Blackbox desktop. Now we also want Firefox to automatically launch so that after the system boots the user is presented with our Kiosk application running in all it's full screen glory.&lt;br /&gt;&lt;br /&gt;This is very simple to accomplish by adding one line to the Blackbox startup script we created in step 9 when setting up the host computer. You'll need to log into Ubuntu as the user you defined during install for this step.&lt;br /&gt;&lt;br /&gt;Open &lt;span style="font-style: italic;"&gt;/user/touchuser/.bbstartup&lt;/span&gt; and add the following line&lt;br /&gt;&lt;pre&gt;#!/bin/sh&lt;br /&gt;idesk &amp;amp;&lt;br /&gt;&lt;b&gt;/usr/bin/firefox &amp;amp;&lt;/b&gt;&lt;br /&gt;exec blackbox&lt;/pre&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-size:100%;"&gt;If everything has gone as I hope, you should have a fully functioning kiosk system. The only thing left to do is buy yourself a fancy &lt;a href="http://www.google.ca/search?q=touchscreen+lcd"&gt;touchscreen LCD&lt;/a&gt; monitor and plug it in.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;References for this setup can be found at the following links.&lt;br /&gt;&lt;a href="http://ubuntuforums.org/showthread.php?t=125084"&gt;HOWTO: A Blackbox Guide&lt;/a&gt;&lt;br /&gt;&lt;a href="http://blackboxwm.sourceforge.net/"&gt;Blackbox Wiki&lt;/a&gt;&lt;br /&gt;&lt;a href="http://idesk.sourceforge.net/wiki/index.php/Main_Page"&gt;iDesk Wiki&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:180%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-9112417894027080011?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/9112417894027080011/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/04/creating-touch-screen-kiosk-using-flex.html#comment-form' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/9112417894027080011'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/9112417894027080011'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/04/creating-touch-screen-kiosk-using-flex.html' title='Creating a Touch Screen Kiosk using Firefox, Ubuntu and Blackbox'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-8261613159838058311</id><published>2008-04-05T13:41:00.000-07:00</published><updated>2008-04-17T12:55:46.820-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><title type='text'>Customizing the Flex ScrollBar with Skins</title><content type='html'>One of the things I love about Flex is the smooth and clean look/feel of the default components. With just a little CSS the default look and feel can be customized to fit most web site designs.  But what do you do when your requirements are very different from what you can accomplish with CSS?  With Flex it's possible to build custom skins and give you're application any look and feel you desire.&lt;br /&gt;&lt;br /&gt;While the process to complete this isn't overly complex it probably helps if you come from a Flash background and also have some strong design skills.&lt;br /&gt;&lt;br /&gt;There are two ways to build skins.  1)  Use images and 2) Use actionscript classes.   For my example I have combined both approaches to customize the look/feel of the default Flex scrollbar.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Summary of the solution&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;- Create a PNG image to use as the background for the scrollbar track.&lt;br /&gt;- Create a PNG image to use as the icon for the scrollbar handle.&lt;br /&gt;- Create an ActionScript class to draw a skin for the scrollbar box.&lt;br /&gt;- Create a CSS Style for the scrollbar which references the new skins&lt;br /&gt;- Apply the StyleName to our scrollbar&lt;br /&gt;&lt;br /&gt;The CSS Style&lt;br /&gt;&lt;pre&gt;.customScroll&lt;br /&gt;{&lt;br /&gt;  /* remove the arrow skins by referencing a null class */&lt;br /&gt;  upArrowSkin: ClassReference(null);&lt;br /&gt;  downArrowSkin: ClassReference(null);&lt;br /&gt;&lt;br /&gt;  /* Embed an image to use as skin for scroll bar track and scroll bar thumbIcon */&lt;br /&gt;  trackSkin: Embed(source="skins/CustomSkinTrack.png");&lt;br /&gt;  thumbIcon: Embed(source="skins/CustomSkinIcon.png");&lt;br /&gt;&lt;br /&gt;  /* Reference action script skin for various states of the scroll bar thumb */&lt;br /&gt;  thumbUpSkin: ClassReference('theme.skins.CustomSkinThumb');&lt;br /&gt;  thumbOverSkin: ClassReference('theme.skins.CustomSkinThumb');&lt;br /&gt;  thumbDownSkin: ClassReference('theme.skins.CustomSkinThumb');&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.kerkness.ca/flexexamples/ScrollSkin/ScollSkin.html"&gt;Click here to view the demo.&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.kerkness.ca/flexexamples/ScrollSkin/srcview/index.html"&gt;Click here to view the source code.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-8261613159838058311?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/8261613159838058311/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/04/customizing-flex-scrollbar-with-skins.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/8261613159838058311'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/8261613159838058311'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/04/customizing-flex-scrollbar-with-skins.html' title='Customizing the Flex ScrollBar with Skins'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-6839864259508253373</id><published>2008-04-05T11:40:00.000-07:00</published><updated>2008-04-05T11:57:58.810-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Simple PHP Captcha</title><content type='html'>One of the contact forms on a business web site I run has been getting a lot of spam attempts submitted to it.  These attempts don't go anywhere but it's becoming a bit of a hassle anyway.  Time to add some sort of Captcha to the form.&lt;br /&gt;&lt;br /&gt;What is Captcha?  (&lt;a href="http://en.wikipedia.org/wiki/Captcha"&gt;from Wikipedia&lt;/a&gt;) A Captcha is a type of challenge-response test used in computing to determine that the user is not run by a computer. The process involves one computer (a server) asking a user to complete a simple test which the computer is able to generate and grade. Because other computers are unable to solve the CAPTCHA, any user entering a correct solution is presumed to be human. A common type of CAPTCHA requires that the user type the letters of a distorted image, sometimes with the addition of an obscured sequence of letters or digits that appears on the screen.&lt;br /&gt;&lt;br /&gt;The term "CAPTCHA" was coined in 2000 by Luis von Ahn, Manuel Blum, Nicholas J. Hopper (all of Carnegie Mellon University), and John Langford (then of IBM). It is a contrived acronym for "Completely Automated Public Turing test to tell Computers and Humans Apart", trademarked by Carnegie Mellon University.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Example with code.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here is a simple PHP script which will generates a Captcha and logs the response in a _SESSION variable.  It requires GD support on the server.  The script uses a randomly selected background image (img1.jpg, img2.jpg, img3.jpg or img4.jpg) and adds the pass key over top of background.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;PHP Captcha Script.&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;// Start sessions&lt;br /&gt;session_start();&lt;br /&gt;&lt;br /&gt;// Create a random string&lt;br /&gt;$fullhash = md5(microtime());&lt;br /&gt;&lt;br /&gt;// Select the first 5 characters of string to use as pass code&lt;br /&gt;$captcha = substr($fullhash,0,5);&lt;br /&gt;&lt;br /&gt;// Select random image filename for use as background&lt;br /&gt;$imgrand = rand(1,4);&lt;br /&gt;$imgfile = 'img'.$imgrand.'.jpg';&lt;br /&gt;&lt;br /&gt;// Create new image using the background image as a template&lt;br /&gt;$image =imagecreatefromjpeg($imgfile);&lt;br /&gt;&lt;br /&gt;// Set colors to use for Captcha text&lt;br /&gt;$txtcolor = imagecolorallocate($image, 255, 255, 255);&lt;br /&gt;$shadowcolor = imagecolorallocate($image, 0, 0, 0);&lt;br /&gt;&lt;br /&gt;// Layer Captcha text over image&lt;br /&gt;imagestring($image, 6, 21, 11, $captcha, $shadowcolor);&lt;br /&gt;imagestring($image, 5, 20, 10, $captcha, $txtcolor);&lt;br /&gt;&lt;br /&gt;// Add pass code to _SESSION variable&lt;br /&gt;$_SESSION['captchakey'] = $captcha;&lt;br /&gt;&lt;br /&gt;// Adjust header and output image&lt;br /&gt;header("Content-type: image/jpeg");&lt;br /&gt;imagejpeg($image); &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Usage Example&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Inside a form add the following image tag along with an input field for the user to enter the pass code into.  When validating the form check the user submitted info against the _SESSION variable 'captchakey'&lt;br /&gt;&lt;pre&gt;&amp;lt;img src="captcha.php"&amp;gt;&lt;/pre&gt;&lt;a href="http://www.mayberryfineart.com/captcha/captcha.php"&gt;Click here to see a demo.&lt;br /&gt;&lt;/a&gt;&lt;a href="http://www.mayberryfineart.com/captcha"&gt;Click here to copy my background images.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-6839864259508253373?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/6839864259508253373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/04/simple-php-captcha.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/6839864259508253373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/6839864259508253373'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/04/simple-php-captcha.html' title='Simple PHP Captcha'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-8989085708161922347</id><published>2008-04-03T17:02:00.001-07:00</published><updated>2008-04-03T17:07:16.679-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='links'/><title type='text'>Link Fest</title><content type='html'>I've been on vacation for the last couple of weeks so there hasn't been any note worthy things to post.  So here is a collection of good links I've found recently.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blog.paranoidferret.com/index.php/2007/11/30/the-flex-drop-shadow/"&gt;The Flex Drop Shadow Explained&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://recaptcha.net/whyrecaptcha.html"&gt;Re CAPTCHA&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.mattcutts.com/blog/backup-gmail-in-linux-with-getmail/"&gt;&lt;br /&gt;Backup Gmail on Linux&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://lifehacker.com/362062/create-your-own-cross+platform-backup-server"&gt;Create Your Own Cross Platform Backup Server&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.alivepdf.org/"&gt;Actionscript PDF Library&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sujitreddyg.wordpress.com/2008/02/05/splitting-flex-application-into-modules/"&gt;Spliting Flex Application Into Modules&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-8989085708161922347?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/8989085708161922347/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/04/link-fest.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/8989085708161922347'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/8989085708161922347'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/04/link-fest.html' title='Link Fest'/><author><name>followr</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-1220276361349787268</id><published>2008-03-17T12:15:00.000-07:00</published><updated>2008-03-17T21:14:28.956-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='components'/><title type='text'>Flex SuperLabel Component : An Easy How To on Extending Flex Components with Custom Events and Effects</title><content type='html'>Since I switched from developing XUL/Javascript based RIAs using the Mozilla platform to programming in Flex and Actionscript one of the things I have been most impressed with is how easy it is to extend existing components and customize them to fit my needs perfectly.&lt;br /&gt;&lt;br /&gt;Recently (as in 10 minutes ago) I was working on laying out the interface for a new application which displays some dynamically changing content. One part of the interface which was dynamically changing was the page title which I was displaying as a &lt;span style="font-style: italic;"&gt;Label &lt;/span&gt;component. I thought it would be nice to add a small effect every time the &lt;span style="font-style: italic;"&gt;text &lt;/span&gt;property for &lt;span style="font-style: italic;"&gt;Label &lt;/span&gt;changed.  Looking at the language reference documentation for the &lt;span style="font-style: italic;"&gt;Label &lt;/span&gt;component I noticed there was no built in event or effect which could be triggered when the text property is updated.&lt;br /&gt;&lt;br /&gt;No problem, I thought.  I'll just add that in.  So with less than 25 lines of code and in less time than it is taking to type this post I was done.&lt;br /&gt;&lt;br /&gt;Here is a summary of the steps I took to create my new &lt;span style="font-style: italic;"&gt;SuperLabel &lt;/span&gt;Component.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Created a new Actionscript Class&lt;/li&gt;&lt;li&gt;Added Metatags for the new Event and new Effect&lt;/li&gt;&lt;li&gt;Created a function which overrides the text property setter function&lt;/li&gt;&lt;li&gt;done.&lt;/li&gt;&lt;/ul&gt;Here is the source code for the new component.&lt;br /&gt;&lt;pre&gt;package claire.com&lt;br /&gt;{&lt;br /&gt; import mx.controls.Label;  &lt;br /&gt; import flash.events.Event; &lt;br /&gt;&lt;br /&gt; [Event(name="textChange", type="flash.events.Event")]&lt;br /&gt; [Effect(name="textChangeEffect", event="textChange")]&lt;br /&gt;&lt;br /&gt; public class SuperLabel extends Label&lt;br /&gt; {&lt;br /&gt;   public function SuperLabel()&lt;br /&gt;   {&lt;br /&gt;      super();&lt;br /&gt;   }&lt;br /&gt;   public override function set text(value:String):void&lt;br /&gt;   {&lt;br /&gt;     if ( value != this.text )&lt;br /&gt;     {&lt;br /&gt;        this.dispatchEvent( new Event('textChange') );&lt;br /&gt;     }&lt;br /&gt;     super.text = value;&lt;br /&gt;   }&lt;br /&gt; }&lt;br /&gt;}&lt;/pre&gt;There you go. It really is that easy.&lt;br /&gt;&lt;br /&gt;Just to finish off here is how you use the new component in MXML.&lt;br /&gt;&lt;pre&gt;&amp;lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:com="claire.com.*"&amp;gt;&lt;br /&gt;&amp;lt;mx:WipeRight id="myEffect" duration="750" /&amp;gt;&lt;br /&gt;&amp;lt;com:SuperLabel textChangeEffect="{myEffect}"/&amp;gt;&lt;br /&gt;&amp;lt;/Application&amp;gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-1220276361349787268?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/1220276361349787268/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/03/flex-superlabel-component-easy-how-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/1220276361349787268'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/1220276361349787268'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/03/flex-superlabel-component-easy-how-to.html' title='Flex SuperLabel Component : An Easy How To on Extending Flex Components with Custom Events and Effects'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-1907066309002949274</id><published>2008-03-13T12:16:00.000-07:00</published><updated>2008-03-13T12:26:47.869-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><title type='text'>Flex Tip: Positioning components in Adobe Flex with no default gaps, padding or margins</title><content type='html'>If you're new to Flex and you've been banging your head against a wall trying to get components to position themselves properly then hopefully this tip will help.&lt;br /&gt;&lt;br /&gt;By default Flex adds about a 10px margin around most components. For example if you're trying to create a row of buttons that are all butted right up against each other with no space in between the following code won't cut it.&lt;br /&gt;&lt;pre&gt;&amp;lt;!-- these buttons will all have about a 10px gap in between them --&amp;gt;&lt;br /&gt;&amp;lt;mx:HBox&amp;gt;&lt;br /&gt;&amp;lt;mx:Button label='Button 1'/&amp;gt;&lt;br /&gt;&amp;lt;mx:Button label='Button 1'/&amp;gt;&lt;br /&gt;&amp;lt;mx:Button label='Button 1'/&amp;gt;&lt;br /&gt;&amp;lt;/mx:Hbox&amp;gt;&lt;/pre&gt;&lt;br /&gt;To make that gap go away you need to add &lt;i&gt;horizontalGap="0"&lt;/i&gt; to the &lt;span style="font-style: italic;"&gt;HBox&lt;/span&gt; tag as in the following example&lt;br /&gt;&lt;pre&gt;&amp;lt;!-- these buttons will have no gap in between them --&amp;gt;&lt;br /&gt;&amp;lt;mx:HBox horizontalGap="0"&amp;gt;&lt;br /&gt;&amp;lt;mx:Button label='Button 1'/&amp;gt;&lt;br /&gt;&amp;lt;mx:Button label='Button 1'/&amp;gt;&lt;br /&gt;&amp;lt;mx:Button label='Button 1'/&amp;gt;&lt;br /&gt;&amp;lt;/mx:Hbox&amp;gt;&lt;/pre&gt;&lt;br /&gt;So there you go. &lt;span style="font-style: italic;"&gt;horizontalGap="0"&lt;/span&gt; and like wise &lt;span style="font-style: italic;"&gt;verticalGap="0"&lt;/span&gt; is what you're looking for if you can't figure out why your components have a default margin.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-1907066309002949274?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/1907066309002949274/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/03/flex-tip-positioning-components-in.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/1907066309002949274'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/1907066309002949274'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/03/flex-tip-positioning-components-in.html' title='Flex Tip: Positioning components in Adobe Flex with no default gaps, padding or margins'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-7115192761595661801</id><published>2008-03-12T09:16:00.000-07:00</published><updated>2008-03-12T11:27:59.701-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><title type='text'>Flex Tip: Adding custom events to Actionscript components</title><content type='html'>One of the key features of building a Flex application with custom components is being able to define and dispatch custom events.  In order to do this you need to add some metadata to your custom component.&lt;br /&gt;&lt;br /&gt;If you're creating an actionscript class for your custom component you declare the metadata before defining your class as in the following example.&lt;br /&gt;&lt;pre&gt;package claire.libs&lt;br /&gt;{&lt;br /&gt;  ....   &lt;br /&gt;  [Event(name="serviceError", type="flash.events.Event")]&lt;br /&gt;  public class ClaireService extends HTTPService&lt;br /&gt;  {&lt;br /&gt;    .....&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;You will now be able to add an event listener in MXML with the following.&lt;br /&gt;&lt;pre&gt;&amp;lt;mycom:ClaireService id="myService" serviceError="handlerFunction(event)"/&amp;gt;&lt;/pre&gt;&lt;br /&gt;While the above example works it is important to note that the following example will NOT work. Notice the ";" at the end of the Event metatag. Took me about 2 hours to figure this out so hopefully this post will save someone else some time.&lt;br /&gt;&lt;pre&gt;package claire.libs&lt;br /&gt;{&lt;br /&gt;  ....   &lt;br /&gt;  [Event(name="serviceError", type="flash.events.Event")];&lt;br /&gt;  public class ClaireService extends HTTPService&lt;br /&gt;  {&lt;br /&gt;    .....&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-7115192761595661801?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/7115192761595661801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/03/flex-tip-adding-custom-events-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/7115192761595661801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/7115192761595661801'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/03/flex-tip-adding-custom-events-to.html' title='Flex Tip: Adding custom events to Actionscript components'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-8124656284682281160</id><published>2008-03-07T14:21:00.000-08:00</published><updated>2008-03-07T19:00:04.894-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='components'/><title type='text'>Control Access to Flex Components with Group Based Permissions</title><content type='html'>When building a large application which has many different views it's likely that you'll want to grant some users more access than others.  You might have some components that all guests are permitted to view and also have other components that only admin users are allowed to use.&lt;br /&gt;&lt;br /&gt;A common way to accomplish this is to assign all users to different user groups and then control what user groups are allowed to view certain parts of your application.&lt;br /&gt;&lt;br /&gt;The example I show here focuses only on controlling the 'visible' property of a component and therefore only addresses what interface elements the user is allowed to see.  I plan to expand on this example in the future to also address the user's ability to access specific sets of data.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Permit and PermitCondition Classes&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In order to have a central repository of permissions and information on the current user I created a singlton class called Permit and another class called PermitCondition. Using a singlton ensures that only one instance of the class will be created and can still be easily accessible anywhere in your application.&lt;br /&gt;&lt;br /&gt;The Permit class keeps information on the current user and is responsible for creating instances of the PermitCondition class.&lt;br /&gt;&lt;br /&gt;Each instance of PermitCondition defines a single permission requirement for a single component by declaring if a specific user group is allowed to view the component or is explicitly blocked from viewing the component. Components can have multiple PermitConditions allowing for more complex permissions.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Summary of Example Application&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;a href="http://www.kerkness.ca/flexexamples/PermitExample/PermitExample.html"&gt;View the demo&lt;/a&gt; : &lt;a href="http://www.kerkness.ca/flexexamples/PermitExample/srcview/index.html"&gt;View demo source&lt;/a&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;In my example application I define permissions for 3 sample components in the main MXML application file.  I then use a LogIn component which sets the user's group memberships.  Both the main MXML application and the LogIn component use the same singlton instance of the Permit class.&lt;br /&gt;&lt;br /&gt;For the purpose of keeping this example simple my LogIn component manually sets users group permissions from a couple of simple functions. In a more complete application you would want your LogIn component to accept a username and password and define user groups after calling an HTTPService and likely querying a database.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Creating and Accessing the Permit Class&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Use the following code to get access to the Permit singlton.&lt;br /&gt;&lt;pre&gt;import claire.libs.Permit;&lt;br /&gt;private var appPermit:Permit = Permit.getInstance();&lt;/pre&gt;&lt;span style="font-weight: bold;"&gt;Defining Component Permissions&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Use the following code to define permissions for individual components&lt;pre&gt;appPermit.applyPermit('adminaccess',Permit.ALLOW,'admin',box3);&lt;br /&gt;appPermit.applyPermit('adminaccess',Permit.BLOCK,'guest',box3);&lt;/pre&gt;&lt;br /&gt;The applyPermit method accepts 4 properties&lt;pre&gt;applyPermit( permitname:String, condition:String, group:String,component:UIComponent)&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;permitname&lt;/span&gt; : A unique identifier for the declared permit.&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;condition:&lt;/span&gt; Accepted values are Permit.ALLOW or Permit.BLOCK.  Determines if the supplied group name is granted or blocked access to component.&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;group:&lt;/span&gt; Name of a user group checked in the condition.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;component:&lt;/span&gt; a UIComponent which the permit is applied against.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Adding User Details to the Permit Class&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Use the following code to add user details to the Permit class after successfully validating the user's  username and password.&lt;br /&gt;&lt;pre&gt;appPermit.loggedIn = true;&lt;br /&gt;appPermit.addGroup('guest') // Adds user to group 'guest'&lt;/pre&gt;When a user is added to a group the Permit class will automatically check PermitConditions and update the visible property of components.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-8124656284682281160?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/8124656284682281160/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/03/control-access-to-flex-components-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/8124656284682281160'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/8124656284682281160'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/03/control-access-to-flex-components-with.html' title='Control Access to Flex Components with Group Based Permissions'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-2796637504667205722</id><published>2008-03-05T12:28:00.001-08:00</published><updated>2008-03-05T12:44:39.344-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='sudoku'/><title type='text'>Sudoku Updated</title><content type='html'>I've had a chance to add some nice features to my Sudoku game.  User's can now save their games and return later to pick up where they left off.  I've limited each user to 6 saved games and they must register a username/password first.  Email is not required for registration because what would be the point.&lt;br /&gt;&lt;br /&gt;This whole Sudoku game has basically been an exercise to learn about Flex development and see what it takes to build a full application.  I have to say that I am very impressed with what I've been able to accomplish in a short period of time.&lt;br /&gt;&lt;br /&gt;Anyway. If you like Sudoku I would appreciate any comments you might have on my game.&lt;br /&gt;&lt;a href="http://www.kerkness.ca/sudoku"&gt;&lt;br /&gt;http://www.kerkness.ca/sudoku&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-2796637504667205722?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/2796637504667205722/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/03/sudoku-updated.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/2796637504667205722'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/2796637504667205722'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/03/sudoku-updated.html' title='Sudoku Updated'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-5294393082330476008</id><published>2008-03-04T21:31:00.001-08:00</published><updated>2008-03-04T22:07:04.409-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><title type='text'>Searching a complex ArrayCollection in Flex and how I hate the damn IViewCursor</title><content type='html'>I'll preface this post as I do many by stating that I'm relatively new to Actionscript and Flex so I'm not really sure if the code I present here is a solution or a hack. In either case it works.&lt;br /&gt;&lt;br /&gt;While building a 'Save Game' feature for my &lt;a href="http://www.kerkness.ca/sudoku"&gt;Sudoku game&lt;/a&gt; I was came across a situation where I needed to search an existing &lt;span style="font-style: italic;"&gt;ArrayCollection  &lt;/span&gt;for the ID of a previously saved game. I knew what the ID was but just needed to locate it's index position in the collection. While looking at the Flex documentation I noticed that the &lt;span style="font-style: italic;"&gt;ArrayCollection &lt;/span&gt;component has a nice method called &lt;span style="font-style: italic;"&gt;getItemIndex. &lt;/span&gt;However this wasn't going to be any use to me because &lt;span style="font-style: italic;"&gt;getItemIndex &lt;/span&gt;only finds exact matches of an entire object and I needed to match only a single value.  This lead me to look into the use of an &lt;span style="font-style: italic;"&gt;IViewCursor&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;While creating a cursor to access and manipulate and &lt;span style="font-style: italic;"&gt;ArrayCollection &lt;/span&gt;seems like an intuitive concept trying to understand how to use it frankly makes my head spin.  So instead I just wrote a simple function.  If someone can tell me why using an &lt;span style="font-style: italic;"&gt;IViewCursor &lt;/span&gt;is better or easier than the following function I would like to hear it ( and see an example ).&lt;br /&gt;&lt;pre&gt;// returns the index position of object with matching usid value&lt;br /&gt;private function usidSearch( usid:Number, coll:ArrayCollection ):Number&lt;br /&gt;{&lt;br /&gt;var o:Object;&lt;br /&gt;for ( var i:Number = 0; i&amp;lt;coll.length; i++){&lt;br /&gt; o = coll.getItemAt(i);&lt;br /&gt; if( o.usid == usid) return i;&lt;br /&gt;}&lt;br /&gt;return -1;&lt;br /&gt;}&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-5294393082330476008?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/5294393082330476008/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/03/searching-complex-arraycollection-in.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/5294393082330476008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/5294393082330476008'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/03/searching-complex-arraycollection-in.html' title='Searching a complex ArrayCollection in Flex and how I hate the damn IViewCursor'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-448989824293359482</id><published>2008-03-04T09:19:00.000-08:00</published><updated>2008-03-04T09:51:02.215-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='json'/><category scheme='http://www.blogger.com/atom/ns#' term='components'/><title type='text'>Updated Flex PageList Component and Demo with Google JSON API</title><content type='html'>I've had a chance to completely re-write my PageList component so it runs much smoother and provides easier more flexible use.&lt;br /&gt;&lt;br /&gt;The PageList component let's a user horizontally page through a TileList. The component binds with a HTTPService to provide a continual flow of data.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.kerkness.ca/flexexamples/PageList/MyPageList.html"&gt;Click here to view a demo of the component&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.kerkness.ca/flexexamples/PageList/srcview/index.html"&gt;Click here for full source code&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Things to make note of:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Because the component dynamically adjusts it's own X position it needs to be the child of either an Application, Canvas or Panel.&lt;br /&gt;&lt;br /&gt;The component at the moment has a single results handler which handles a JSON response from a Google API. To use this component you can easily add your own handler functions to handle data specific to your own application.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size:130%;"&gt;Google JSON API&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;The demo I've put together for this component makes use of a Google JSON API which is really handy and easy to access if your Flex project uses the Adobe Corelib library.&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;The Google JSON API can be accessed via the following URLs.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;http://www.searchmash.com/results/images:[query]&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;http://www.searchmash.com/results/blogs:[query]&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;http://www.searchmash.com/results/video:[query]&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;The full url I used in the demo is&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;http://www.searchmash.com/results/images:Apple&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;In order to access the API remotely and not run into any Flex security issues I used a php proxy. &lt;a href="http://kerkness.blogspot.com/2008/02/use-remote-httpservice-in-flex-with-php.html"&gt;Click here for details&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-448989824293359482?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/448989824293359482/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/03/updated-pagelist-component-and-demo.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/448989824293359482'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/448989824293359482'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/03/updated-pagelist-component-and-demo.html' title='Updated Flex PageList Component and Demo with Google JSON API'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-8252563954806391734</id><published>2008-03-03T06:54:00.000-08:00</published><updated>2008-03-03T06:58:19.450-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>Embedding fonts via CSS in Flex</title><content type='html'>Just a handy little reference for embedding fonts via CSS in your Flex applications.&lt;br /&gt;&lt;pre&gt;Label&lt;br /&gt;{&lt;br /&gt;embedFonts: true;&lt;br /&gt;color: #FF0000;&lt;br /&gt;fontFamily: YourFontFamily;&lt;br /&gt;}&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-8252563954806391734?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/8252563954806391734/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/03/embedding-fonts-via-css-in-flex.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/8252563954806391734'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/8252563954806391734'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/03/embedding-fonts-via-css-in-flex.html' title='Embedding fonts via CSS in Flex'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-124601010775926644</id><published>2008-03-01T20:50:00.000-08:00</published><updated>2008-03-01T22:28:47.741-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><title type='text'>Display a time counter in flex</title><content type='html'>For my Sudoku game I wanted to add a simple counter which shows how much time has passed since a user started their game. Should be simple enough, just create a Timer object and have it update a display every second. The problem I ran into was how to easily display the number of seconds passed as a readable time format (example HH:MM:SS). I searched high and low for any type of formatting function which would help but came up short and had to figure out something on my own.&lt;br /&gt;&lt;br /&gt;What I came up with feels like a total hack and I'm certain there has to be a better way to solve this problem.  Anyway, here is my code, it appears to work just fine but would appreciate it if anyone knows of a better solution.&lt;br /&gt;&lt;pre&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br /&gt;&amp;lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"&lt;br /&gt; layout="absolute" creationComplete="init()"&amp;gt;&lt;br /&gt;&amp;lt;mx:Script&amp;gt;&lt;br /&gt;&amp;lt;![CDATA[&lt;br /&gt; // Create Timer object to fire every second with no end&lt;br /&gt; private var myTimer:Timer = new Timer(1000);&lt;br /&gt; &lt;br /&gt; private function init():void&lt;br /&gt; {&lt;br /&gt;   // Add event listener for the time&lt;br /&gt;   myTimer.addEventListener(TimerEvent.TIMER,clockTick);&lt;br /&gt;   myTimer.start();&lt;br /&gt; }&lt;br /&gt; // function to update display&lt;br /&gt; private function clockTick(event:TimerEvent):void&lt;br /&gt; {&lt;br /&gt;   var fullseconds:Number = Timer( event.currentTarget ).currentCount;&lt;br /&gt;   var fullminutes:Number = Math.floor(fullseconds/60);&lt;br /&gt;   var hours:Number = Math.floor(fullseconds/3600);&lt;br /&gt;   var minutes:Number = ( hours &amp;gt; 1 ) ? Math.round((fullseconds-(hours*3600))/60) : Math.floor(fullseconds/60) ;&lt;br /&gt;   var seconds:Number = ( fullseconds &amp;gt; 60 ) ? fullseconds-(fullminutes*60) : fullseconds;&lt;br /&gt;   var hourstr:String = ( hours &amp;lt; 10 ) ? '0'+hours.toString() : hours.toString();&lt;br /&gt;   var minstr:String = ( minutes &amp;lt; 10 ) ? '0'+minutes.toString() : minutes.toString();&lt;br /&gt;   var secstr:String = ( seconds &amp;lt; 10 ) ? '0'+seconds.toString() : seconds.toString();&lt;br /&gt;   if ( minstr == '60' ) minstr = '00';&lt;br /&gt;   if ( secstr == '60' ) secstr = '00';&lt;br /&gt;   myClock.text = hourstr+':'+minstr+':'+secstr;&lt;br /&gt; }&lt;br /&gt;]]&amp;gt;&lt;br /&gt;&amp;lt;/mx:Script&amp;gt;&lt;br /&gt;&amp;lt;mx:Label id="myClock" /&amp;gt;&lt;br /&gt;&amp;lt;/mx:Application&amp;gt;&lt;/pre&gt;&lt;br /&gt;The one part which really bugs me about this is manually adding a '0' to numbers less than 10. If I was working in PHP this would be no problem but being a n00b with actionscript this is the best I could come up with in the hour I had to work on it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-124601010775926644?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/124601010775926644/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/03/display-time-counter-in-flex.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/124601010775926644'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/124601010775926644'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/03/display-time-counter-in-flex.html' title='Display a time counter in flex'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-8700322465663465859</id><published>2008-03-01T11:07:00.000-08:00</published><updated>2008-03-01T11:15:21.589-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><title type='text'>Dynamically moving a Flex Component</title><content type='html'>When it takes me more than 4 or 5 searches on google to find a solution to a problem then for me it's worth blogging about.  I'm either going to help someone else in the same situation or i'm going to highlight my ineptness a finding solutions.&lt;br /&gt;&lt;br /&gt;At any rate I was recently trying to figure out why when moving a component around my application it would snap right back to it's original x/y coordinates.  Turns out you can only move a component when it's parent container is a Canvas, Application or Panel with it's layout property set to 'absolute'.&lt;br /&gt;&lt;br /&gt;So there you go. Happy flexing.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-8700322465663465859?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/8700322465663465859/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/03/dynamically-moving-flex-component.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/8700322465663465859'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/8700322465663465859'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/03/dynamically-moving-flex-component.html' title='Dynamically moving a Flex Component'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-2426763132803528785</id><published>2008-03-01T08:53:00.000-08:00</published><updated>2008-03-01T11:07:56.121-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><title type='text'>Binding in Flex with Getters and Setters</title><content type='html'>When building a component class and using the recommended method of providing access to properties with getter and setter functions you may find that you are unable to bind to these properties. It's actually rather trivial to enable binding but perhaps not overly obvious.  All you need to do is add [Bindable] before the getter function.&lt;br /&gt;&lt;pre&gt; private var _myVar:String;&lt;br /&gt;&lt;br /&gt; [Bindable] public function get myVar():String&lt;br /&gt; {&lt;br /&gt;   return this._myVar;&lt;br /&gt; }&lt;br /&gt; public function set myVar( value:String ):void&lt;br /&gt; {&lt;br /&gt;   this._myVar = value;&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-2426763132803528785?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/2426763132803528785/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/03/binding-in-flex-with-getters-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/2426763132803528785'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/2426763132803528785'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/03/binding-in-flex-with-getters-and.html' title='Binding in Flex with Getters and Setters'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-7423982259114198629</id><published>2008-02-28T09:50:00.000-08:00</published><updated>2008-03-04T09:47:56.912-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='components'/><title type='text'>Flex PageList Component Adds Paging Support to TileList</title><content type='html'>Using the Flex TileList component is a nice way to display a list of products. The one thing the component lacks is the ability to easily display multiple pages of content which is a typical design requirement of most web based stores or product catalgues. For this reason I extended the TileList component into a PageList component.&lt;br /&gt;&lt;br /&gt;The PageList Component works very similar to the TileList but adds PREV/NEXT buttons to the bottom of the list and automatically calls a HTTPService to load it's data. When the User clicks 'next' to view more items the PageList component automatically fetches more records and appends them to the list. This allows the user to browse an entire catalogue of items with a very smooth and transparent process.  Page count is calculated based on the viewable area and the width of list items.&lt;br /&gt;&lt;br /&gt;UPDATE 2: I've completely re-written this class which works much better. The new PageList component has been published along with source code and demo. &lt;a href="http://kerkness.blogspot.com/2008/03/updated-pagelist-component-and-demo.html"&gt;Click here for more details&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-7423982259114198629?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/7423982259114198629/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/02/flex-pagelist-component-adds-paging.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/7423982259114198629'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/7423982259114198629'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/02/flex-pagelist-component-adds-paging.html' title='Flex PageList Component Adds Paging Support to TileList'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-5362225033179829460</id><published>2008-02-27T22:43:00.000-08:00</published><updated>2008-02-27T22:58:54.456-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='php-to-flex'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Use a remote HTTPService in Flex with a PHP Proxy</title><content type='html'>One way to get around the hassle of a common security error when trying to call a HTTPService running on a different domain than your Flex application is to use a simple and local PHP script as a proxy to call the HTTPService for you. Perhaps not a solution you would want to use if you need to load massive piles of data but in most cases it works just fine and takes seconds to set up.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;proxy.php&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;$content = file_get_contents(str_replace(' ','%20',$_GET['url']));&lt;br /&gt;if ($content !== false) {&lt;br /&gt;   echo($content);&lt;br /&gt;} else {&lt;br /&gt;  // there was an error&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;HTTPService in MXML&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&amp;lt;mx:HTTPService id="myService"&lt;br /&gt;url="http://www.localdomain.com/proxy.php?url=http://www.remote.com/api"/&amp;gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-5362225033179829460?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/5362225033179829460/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/02/use-remote-httpservice-in-flex-with-php.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/5362225033179829460'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/5362225033179829460'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/02/use-remote-httpservice-in-flex-with-php.html' title='Use a remote HTTPService in Flex with a PHP Proxy'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-922169341223482039</id><published>2008-02-24T23:54:00.000-08:00</published><updated>2008-03-05T12:44:57.085-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='sudoku'/><title type='text'>Free Online Sudoku Game</title><content type='html'>&lt;script&gt;function openSuduku(){window.open("http://www.kerkness.ca/sudoku/sudoku.php","mysuduku","height=448,width=338");&lt;br /&gt;}&lt;/script&gt;Sudoku Online is a simple Sudoku game built using Adobe Flex 3. Play hundreds of puzzles from 4 skill levels. Game supports full pencil marks.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.kerkness.ca/sudoku"&gt;Click here to play online&lt;/a&gt; or&lt;br /&gt;&lt;a href="javascript:openSuduku()"&gt;Launch the game in a popup&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I am working on adding 'Save' game features and a scoreboard. This is my first cut and would appreciate feed back in the comments.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;UPDATE:&lt;/span&gt; The game has been updated and now allows users to save a game as long as they register a username/password. Each user is allowed to save 6 games.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-922169341223482039?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/922169341223482039/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/02/suduku-game-built-in-flex.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/922169341223482039'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/922169341223482039'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/02/suduku-game-built-in-flex.html' title='Free Online Sudoku Game'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-5266798097474320885</id><published>2008-02-21T13:10:00.001-08:00</published><updated>2008-02-21T15:02:23.233-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='php-to-flex'/><title type='text'>PHP in_array() function in ActionScript for Flex</title><content type='html'>Another common PHP function is in_array() used to determine if a value exsists in an array. Here is the function recreated in actionscript for flex.&lt;br /&gt;&lt;pre&gt;public function in_array( needle:*, haystack:Array ):Boolean&lt;br /&gt;{&lt;br /&gt;   var itemIndex:int = haystack.indexOf( needle );&lt;br /&gt;   return ( itemIndex &lt; 0 ) ? false : true;&lt;br /&gt;}&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-5266798097474320885?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/5266798097474320885/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/02/php-inarray-in-actionscript-for-flex.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/5266798097474320885'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/5266798097474320885'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/02/php-inarray-in-actionscript-for-flex.html' title='PHP in_array() function in ActionScript for Flex'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-8706160758191537662</id><published>2008-02-20T12:30:00.000-08:00</published><updated>2008-07-31T13:03:57.400-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='components'/><title type='text'>Flex On Screen Qwerty Keyboard Component</title><content type='html'>NOTE:&amp;nbsp; I've updated this component. To see the latest version &lt;a href="http://kerkness.blogspot.com/2008/07/updated-flex-qwerty-component.html"&gt;click here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;One of the Flex applications I work on is a touch screen application primarily used to browse a product catalog. Because there is no keyboard physically attached to the touch screen display and it was necessary to have some input from users (primarily for signing up to a mailing list) I built a Qwerty keyboard component for flex.&lt;br /&gt;&lt;br /&gt;The component displays a nearly full set of keys found on your standard Qwerty keyboard with a limited set of special characters. You can assign TextInput and TextArea controls to accept the output from the component and there is a handy method for changing focus to different input fields.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.kerkness.ca/flexexamples/FlexQwerty/FlexQwerty.html"&gt;Click here to view the example application&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.kerkness.ca/flexexamples/FlexQwerty/srcview/index.html"&gt;Click here to view source&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Basic Usage&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&amp;lt;mx:Form width="100%"&amp;gt;&lt;br /&gt;&amp;lt;mx:FormItem label="Field 1" width="100%"&amp;gt;&lt;br /&gt;&amp;lt;mx:TextInput id="field1" focusIn="myQwertyKeypad.newFocus(field1)" width="100%"/&amp;gt;&lt;br /&gt;&amp;lt;/mx:FormItem&amp;gt;&lt;br /&gt;&amp;lt;mx:FormItem label="Field 2" width="100%"&amp;gt;&lt;br /&gt;&amp;lt;mx:TextInput id="field2" focusIn="myQwertyKeypad.newFocus(field2)" width="100%"/&amp;gt;&lt;br /&gt;&amp;lt;/mx:FormItem&amp;gt;&lt;br /&gt;&amp;lt;mx:FormItem label="Field 3" width="100%"&amp;gt;&lt;br /&gt;&amp;lt;mx:TextInput id="field3" focusIn="myQwertyKeypad.newFocus(field3)" width="100%"/&amp;gt;&lt;br /&gt;&amp;lt;/mx:FormItem&amp;gt;&lt;br /&gt;&amp;lt;/mx:Form&amp;gt;&lt;br /&gt;&amp;lt;claire:Qwerty id="myQwertyKeypad" inputControl="{field1}" width="100%"/&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;While probably a pointless component for most Flex Applications this component is very handy for touch screen input requirements.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-8706160758191537662?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/8706160758191537662/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/02/flex-on-screen-qwerty-keyboard.html#comment-form' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/8706160758191537662'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/8706160758191537662'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/02/flex-on-screen-qwerty-keyboard.html' title='Flex On Screen Qwerty Keyboard Component'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-3949352997031151306</id><published>2008-02-20T12:26:00.001-08:00</published><updated>2008-02-20T12:29:02.534-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><title type='text'>Flex FocusManager and Cursor control</title><content type='html'>Working on a component which needs to programatically set focus to a TextInput field and make sure that the cursor is placed at the end of current value.  I found this possible by using both the Flex FocusManager and also the setSelection() method of TextInput.  Figured the code snippit might be useful to other people so here it is.&lt;br /&gt;&lt;pre&gt;//assuming myInputField is the id of a TextInput field&lt;br /&gt;focusManager.setFocus(myInputField);&lt;br /&gt;myInputField.setSelection(myInputField.length, myInputField.length);&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-3949352997031151306?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/3949352997031151306/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/02/flex-focusmanager-and-cursor-control.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/3949352997031151306'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/3949352997031151306'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/02/flex-focusmanager-and-cursor-control.html' title='Flex FocusManager and Cursor control'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-3877627590334297837</id><published>2008-02-19T19:41:00.000-08:00</published><updated>2008-02-19T21:59:42.710-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='components'/><category scheme='http://www.blogger.com/atom/ns#' term='alert'/><title type='text'>AlertTimer Flex Component</title><content type='html'>The Flex AlertTimer component displays a pop up alert window which automatically closes and displays a countdown timer to the user.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.kerkness.ca/flexexamples/AlertTimer/AlertExample.html" target="_blank"&gt;Click here to view an example&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;(right click application to view source)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The alert can be called from a 'show' method which accepts the following properties:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;parent:DisplayObject  =  The component the alert displays over most likely the parent application&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;alertText:String = The message to display in the alert window&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;alertTitle:String = The title of the alert popup&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;modal:Boolean = If true the user will not be able to interact with the rest of the application until the alert closes&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Example usage&lt;br /&gt;&lt;pre&gt;var myAlert:AlertTimer = new AlertTimer();&lt;br /&gt;myAlert.show(this, "my alert message", "my alert title", true);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;You can further customize the AlertTimer by setting more properties.&lt;br /&gt;&lt;pre&gt;var myAlert:AlertTimer = new AlertTimer();&lt;br /&gt;myAlert.duration = 10;&lt;br /&gt;myAlert.buttonText = "Click here to close now";&lt;br /&gt;myAlert.alertWidth = 200;&lt;br /&gt;myAlert.counterText = "This window will self destruct in ";&lt;br /&gt;myAlert.show(this, "my alert message", "my alert title", true);&lt;/pre&gt;&lt;br /&gt;While this component serves my purpose just fine it can certainly be expanded upon to include the full set of features available in a regular Flex Alert. For starters I'm pretty new to ActionScript and Flex so I wasn't able to figure out how to actually extend the current Alert class. So instead I just created my own component and therefore their isn't the ability to use multiple buttons like you can with an Alert. That said, if you were going to use multiple buttons you may not want to automatically close the alert on a timer. &lt;br /&gt;&lt;br /&gt;I do realize that you can easily close a regular alert using the setTimeout() function and the PopUpManager, but then you can't display a dynamic countdown which I think is more user friendly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-3877627590334297837?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/3877627590334297837/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/02/alerttimer-flex-component.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/3877627590334297837'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/3877627590334297837'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/02/alerttimer-flex-component.html' title='AlertTimer Flex Component'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-3007424152804943939</id><published>2008-02-18T22:09:00.000-08:00</published><updated>2008-02-18T22:21:12.779-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mac'/><title type='text'>Mac vs PC vs Linux as a development platform</title><content type='html'>I've been programming for nearly 15 years. I've been working with both PCs and MACs for about 10 years. Most of my programming exprience has been building web based applications that don't really realy on one platform or the other (from a client perspective at least as the server is usually linux).  I feel that I am in a good position to judge what os/hardware set up makes the best workstation.&lt;br /&gt;&lt;br /&gt;I've got an Ubuntu desktop, a XP Professional desktop and a new iMac running leopard at work. At home I run an XP professional workstation and G4 10.3 panther laptop. Depending on the workstation I run a variety of IDEs and programming tools including putty, Eclipse, WinScp, SlickEdit and a plain old terminal as the most prominent.&lt;br /&gt;&lt;br /&gt;I think I've finally come to the conclusion that OSX Leopard  is the definative way to go for the forseable future for one reason and one reason only.&lt;br /&gt;&lt;br /&gt;It's quiet.  I hate hearing a computer churn.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-3007424152804943939?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/3007424152804943939/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/02/mac-vs-pc-vs-linux-as-development.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/3007424152804943939'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/3007424152804943939'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/02/mac-vs-pc-vs-linux-as-development.html' title='Mac vs PC vs Linux as a development platform'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-3352658996536704614</id><published>2008-02-18T14:17:00.000-08:00</published><updated>2008-02-18T17:59:46.921-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='php-to-flex'/><title type='text'>PHP ucfirst() and ucwords() in Flex</title><content type='html'>Another common PHP function converted to ActionScript for use in a Flex application.&lt;br /&gt;&lt;pre&gt;public function ucfirst( str:String ):String&lt;br /&gt;{&lt;br /&gt;  return str.substr(0,1).toUpperCase()+str.substr(1);&lt;br /&gt;}&lt;br /&gt;public function ucwords( str:String ):String&lt;br /&gt;{&lt;br /&gt;  var myArr:Array = str.split(' ');&lt;br /&gt;  for (var i:int in myArr ) {&lt;br /&gt;     myArr[i] = ucfirst( myArr[i] );&lt;br /&gt;  }&lt;br /&gt;  return myArr.join(' ');&lt;br /&gt;}&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-3352658996536704614?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/3352658996536704614/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/02/php-ucfirst-and-ucwords-in-flex.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/3352658996536704614'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/3352658996536704614'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/02/php-ucfirst-and-ucwords-in-flex.html' title='PHP ucfirst() and ucwords() in Flex'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-3732423525167446247</id><published>2008-02-18T14:07:00.000-08:00</published><updated>2008-02-18T17:59:31.235-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='php-to-flex'/><title type='text'>PHP strtoupper() and strtolower() in Flex</title><content type='html'>Having been a PHP programmer for many years and only now in the last month started to learn Flex and ActionScript I find I'm always looking for ways to get something done in ActionScript which I know how to do in PHP.  These are pretty straight forward and simple functions but sometimes it's nice to have a reference.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;PHP strtoupper( $string ) and strtolower( $string ) in Flex&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;public function strtoupper( str:String ):void&lt;br /&gt;{&lt;br /&gt; return str.toUpperCase();&lt;br /&gt;}   &lt;br /&gt;public function strtolower( str:String ):void&lt;br /&gt;{&lt;br /&gt; return str.toLowerCase();&lt;br /&gt;}&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-3732423525167446247?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/3732423525167446247/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/02/php-strtoupper-and-strtolower-in-flex.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/3732423525167446247'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/3732423525167446247'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/02/php-strtoupper-and-strtolower-in-flex.html' title='PHP strtoupper() and strtolower() in Flex'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-1035334879858614888</id><published>2008-02-18T10:37:00.000-08:00</published><updated>2008-02-18T12:16:43.479-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><title type='text'>Flex htmlText and Word Wrap</title><content type='html'>It's a little ridiculous how long it took me to figure this out.  I've been trying to layout a block of text in my Flex application and use simple html tags and get word wrapping to display properly.  Searching the blogosphere wasn't turning up much solutions.  Turns out it's actually rather simple to do but I'm a little surprised no posts or examples anywhere really spells it out.&lt;br /&gt;&lt;pre&gt;&amp;lt;mx:Text condenseWhite="true" width="100%"&amp;gt;&lt;br /&gt;&amp;lt;mx:htmlText&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;  This is some&amp;lt;br&amp;gt;&lt;br /&gt;  text with simple &amp;lt;b&amp;gt;Html Formatting&amp;lt;/b&amp;gt;. And this is a really really&lt;br /&gt;really long line of text which we would want to auto wrap nicely.&lt;br /&gt;]]&amp;gt;&amp;lt;/mx:htmlText&amp;gt;&lt;br /&gt;&amp;lt;/Text&amp;gt;&lt;/pre&gt;The important thing in this example is &lt;span style="font-style: italic;"&gt;condenseWhite="true" &lt;/span&gt;and &lt;span style="font-style: italic;"&gt;width="100%". &lt;/span&gt;If you don't set condenseWhite to true then Flex will render line breaks and white space.  If you don't declare the width then long lines will not automatically wrap.&lt;br /&gt;&lt;br /&gt;Believe it or not it took me several hours to figure this out.  That probably doesn't say much for my own programming skills. Hopefully this post will save other people from waisting time.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-1035334879858614888?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/1035334879858614888/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/02/flex-htmltext-and-word-wrap.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/1035334879858614888'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/1035334879858614888'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/02/flex-htmltext-and-word-wrap.html' title='Flex htmlText and Word Wrap'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-4571592423670785027</id><published>2008-02-17T22:07:00.000-08:00</published><updated>2008-02-18T17:59:12.988-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='php-to-flex'/><category scheme='http://www.blogger.com/atom/ns#' term='components'/><title type='text'>Flex / JSON / PHP Example Application</title><content type='html'>&lt;span style="font-size:100%;"&gt;While trying to teach myself how to best use PHP and Flex together I build the following example application. Source code and details on how the application works are included.&lt;br /&gt;&lt;br /&gt;The example application uses JSON (JavaScript Object Notation) to facilitate a smooth and simple way of providing PHP Arrays that can be used by a Flex Application. A more complete HowTo is included in the application.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.kerkness.ca/flexexamples/FlexPhp.html" target="_blank"&gt;Click here to launch the application&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:85%;"&gt;(right click to view source)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Requirements&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This application requires a php class called &lt;a href="http://www.kerkness.ca/flexexamples/phpsrc/json.php.html"&gt;json.php&lt;/a&gt; which encodes a PHP array and the &lt;span style="font-weight: bold;"&gt;corelib&lt;/span&gt; libraries &lt;a href="http://labs.adobe.com/wiki/index.php/ActionScript_3:resources:apis:libraries#corelib"&gt;available from Adobe Labs&lt;/a&gt; used to decode the array in Flex. You'll also need a mysql database with a single table called 'people' with the fields 'firstname','lastname' and 'category'.&lt;br /&gt;&lt;br /&gt;To install the corelib libraries I used a &lt;a href="http://www.mikechambers.com/blog/2006/03/28/tutorial-using-json-with-flex-2-and-actionscript-3/"&gt;post at Mike Chambers blog.&lt;/a&gt;&lt;br /&gt;The json.php class originally comes from &lt;a href="http://mike.teczno.com/"&gt;M. Migurski&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;MXML Summary&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Right click the example application to view the MXML source&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;FlexPhp.mxml : Main Application file. Contains a navigation tab and loads the components PhpDataGrid.mxml and PhpForm.mxml&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;PhpDataGrid.mxml : Contains a simple DataGrid and ActionScript for calling read.php&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;PhpForm.mxml : Contains a simple Flex form and ActionScript for calling write.php&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:130%;"&gt;&lt;b&gt;Description of PHP Files&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.kerkness.ca/flexexamples/phpsrc/read.php.html"&gt;read.php&lt;/a&gt; : File queries the database and returns a JSON encoded array to the Flex application.&lt;br /&gt;&lt;a href="http://www.kerkness.ca/flexexamples/phpsrc/write.php.html"&gt;write.php&lt;/a&gt; : File accepts data posted from Flex form, updates the database and sends a JSON encoded response back to the flex application.&lt;br /&gt;&lt;a href="http://www.kerkness.ca/flexexamples/phpsrc/json.php.html"&gt;json.php&lt;/a&gt; : Class file used to encode PHP arrays into a JSON formatted string.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;a href="http://www.kerkness.ca/flexexamples/phpsrc/mysql.php.html"&gt;mysql.php&lt;/a&gt; : Class file for accessing and updating the database.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;a href="http://www.kerkness.ca/flexexamples/phpsrc/conf.php.html"&gt;conf.php&lt;/a&gt; : Simple configuration file for keeping database access information and debugging.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;&lt;/b&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-4571592423670785027?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/4571592423670785027/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/02/flex-json-php-example-application.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/4571592423670785027'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/4571592423670785027'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/02/flex-json-php-example-application.html' title='Flex / JSON / PHP Example Application'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-337100357714577328</id><published>2008-02-15T14:20:00.001-08:00</published><updated>2008-02-15T21:36:36.532-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='php-to-flex'/><title type='text'>String Replace Function in Flex</title><content type='html'>I'm not sure if this is a redundant function or not.  I know that Flex String objects have a replace() method but as far as I can tell this only replaces the first match and not every match in a string.&lt;br /&gt;&lt;br /&gt;Here is an actionscript function for flex which works the same as the php str_replace() function.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;str_replace( needle, replacement, haystack ) in ActionScript&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;public function str_replace(needle:String, replacement:String, haystack:String):String&lt;br /&gt;{&lt;br /&gt;  var strArr:Array = haystack.split(needle);&lt;br /&gt;  return strArr.join(replacement);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If this is a pointless function and there is an easier way to accomplish this built into flex I would love to hear about it. I looked over the language reference documents and couldn't find something.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-337100357714577328?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/337100357714577328/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/02/match-all-string-replace-function-in.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/337100357714577328'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/337100357714577328'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/02/match-all-string-replace-function-in.html' title='String Replace Function in Flex'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-825352107713370189</id><published>2008-02-15T11:35:00.001-08:00</published><updated>2008-02-15T11:54:53.020-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='components'/><title type='text'>Flex Hint Bubble Component</title><content type='html'>Flex makes it very easy to display tooltips associated with buttons, form fields and other interface components in your application.  However sometimes a tooltip isn't enough because they only display themselves when a user mouses over a specific button or object. Well what if the user doesn't know where to point their mouse?&lt;br /&gt;&lt;br /&gt;For this purpose I created a custom component called a HintBubble.  The HintBubble can be triggered by any event using a function called toggleHintBubble. When toggled the Hint Bubble will fly into view displaying whatever hint message you like and then Fade out of view after XX number of seconds have passed. In one of my applications I'm using this remind users of a search button on the screen.&lt;br /&gt;&lt;br /&gt;The component is effective for these purposes but could be easily expanded or customized to suit many purposes. Transitions and styles are hard coded but could also easily be customized to suit different needs.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;HintBubble.mxml&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br /&gt;&amp;lt;mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()"&lt;br /&gt;backgroundAlpha="0.0" horizontalScrollPolicy="off" verticalScrollPolicy="off"&amp;gt;&lt;br /&gt;&amp;lt;mx:Script&amp;gt;&lt;br /&gt;&amp;lt;![CDATA[&lt;br /&gt;import mx.effects.easing.Cubic;&lt;br /&gt;import flash.events.TimerEvent;&lt;br /&gt;import flash.utils.Timer; &lt;br /&gt;// duration = Number of seconds to display hint bubble&lt;br /&gt;[Bindable]&lt;br /&gt;public var duration:Number = 4; &lt;br /&gt;// hintText = Main text for hint bubble&lt;br /&gt;[Bindable]&lt;br /&gt;public var hintText:String;&lt;br /&gt;[Bindable]&lt;br /&gt;// hintTitle = Title for the hint bubble&lt;br /&gt;public var hintTitle:String;&lt;br /&gt;[Bindable]&lt;br /&gt;// leftTo = Left position to move hint bubble to on display&lt;br /&gt;public var leftTo:Number;&lt;br /&gt;[Bindable]&lt;br /&gt;// hintIcon = Icon to use for hint bubble.&lt;br /&gt;public var hintIcon:String;&lt;br /&gt;// Hint Timer Object    &lt;br /&gt;private var hintTimer:Timer = new Timer(1000,duration);&lt;br /&gt;// Initiate function adds event to close hintbubble when timer ends&lt;br /&gt;public function init():void&lt;br /&gt;{&lt;br /&gt; hintTimer.addEventListener(TimerEvent.TIMER_COMPLETE, closeHintBubbleOnTimer);&lt;br /&gt;}&lt;br /&gt;// opens hint bubble and starts timer   &lt;br /&gt;public function toggleHintBubble():void&lt;br /&gt;{&lt;br /&gt; hintTimer.reset();&lt;br /&gt; hintTimer.start();    &lt;br /&gt;  openHintBubble();&lt;br /&gt; }&lt;br /&gt; // opens hint bubble without starting timer&lt;br /&gt;public function openHintBubble():void&lt;br /&gt;{&lt;br /&gt; this.currentState = 'ShowHint';&lt;br /&gt;}&lt;br /&gt;// closes hint bubble without transitions. Returns to base state&lt;br /&gt;public function closeHintBubble():void&lt;br /&gt;{&lt;br /&gt; this.currentState = '';&lt;br /&gt;}&lt;br /&gt;// closes hint bubble with transition. Resets timer.&lt;br /&gt;public function hideHintBubble():void&lt;br /&gt;{&lt;br /&gt;  hintTimer.reset();&lt;br /&gt; this.currentState = 'HideHint';&lt;br /&gt;}&lt;br /&gt;// closes hint button from event timer&lt;br /&gt;public function closeHintBubbleOnTimer(event:TimerEvent):void&lt;br /&gt;{&lt;br /&gt; this.currentState = 'HideHint';&lt;br /&gt;}&lt;br /&gt;]]&amp;gt;&lt;br /&gt;&amp;lt;/mx:Script&amp;gt;&lt;br /&gt;&amp;lt;mx:states&amp;gt;&lt;br /&gt;&amp;lt;mx:State name="ShowHint"&amp;gt;&lt;br /&gt; &amp;lt;mx:SetStyle target="{this}" name="left" value="{leftTo}"/&amp;gt;&lt;br /&gt; &amp;lt;/mx:State&amp;gt;&lt;br /&gt;&amp;lt;mx:State name="HideHint" basedOn="ShowHint"&amp;gt;&lt;br /&gt; &amp;lt;mx:SetProperty target="{myHintBubble}" name="visible" value="false"/&amp;gt;&lt;br /&gt;&amp;lt;/mx:State&amp;gt;&lt;br /&gt;&amp;lt;/mx:states&amp;gt;&lt;br /&gt;&amp;lt;mx:transitions&amp;gt;&lt;br /&gt;&amp;lt;mx:Transition fromState="" toState="ShowHint"&amp;gt;&lt;br /&gt; &amp;lt;mx:Parallel&amp;gt;&lt;br /&gt;  &amp;lt;mx:Move duration="1250" target="{this}" easingFunction="{Cubic.easeOut}"/&amp;gt;&lt;br /&gt; &amp;lt;/mx:Parallel&amp;gt;&lt;br /&gt;&amp;lt;/mx:Transition&amp;gt;&lt;br /&gt;&amp;lt;mx:Transition fromState="ShowHint" toState="HideHint"&amp;gt;&lt;br /&gt; &amp;lt;mx:Parallel&amp;gt;&lt;br /&gt;  &amp;lt;!-- ** After HideHint state completes it's transition state is immediately set to default ** --&amp;gt;&lt;br /&gt;  &amp;lt;mx:Dissolve duration="1000" alphaFrom="1.0" alphaTo="0.0" target="{myHintBubble}"&lt;br /&gt;     effectEnd="this.currentState=''"/&amp;gt;&lt;br /&gt; &amp;lt;/mx:Parallel&amp;gt;&lt;br /&gt;&amp;lt;/mx:Transition&amp;gt;&lt;br /&gt;&amp;lt;mx:Transition fromState="HideHint" toState=""&amp;gt;&lt;br /&gt; &amp;lt;mx:Parallel&amp;gt;&lt;br /&gt;  &amp;lt;mx:Dissolve duration="1000" alphaFrom="0.0" alphaTo="1.0" target="{myHintBubble}"/&amp;gt;&lt;br /&gt; &amp;lt;/mx:Parallel&amp;gt;&lt;br /&gt;&amp;lt;/mx:Transition&amp;gt;&lt;br /&gt;&amp;lt;/mx:transitions&amp;gt;&lt;br /&gt;&amp;lt;mx:Canvas backgroundAlpha="0.0" visible="true" id="myHintBubble"&amp;gt;&lt;br /&gt;&amp;lt;mx:HBox backgroundColor="#F6E285" cornerRadius="16" verticalAlign="middle"&lt;br /&gt; borderStyle="solid" borderColor="#FFFFFF" themeColor="#FFFFFF" alpha="0.85"&lt;br /&gt; paddingTop="20" paddingLeft="15" paddingBottom="15" paddingRight="20"&amp;gt;&lt;br /&gt;&amp;lt;mx:Image source="{hintIcon}" scaleContent="true" width="50" height="50"/&amp;gt;&lt;br /&gt;&amp;lt;mx:VBox backgroundAlpha="0.0"&amp;gt;&lt;br /&gt;&amp;lt;mx:Text color="#000000" text="{hintTitle}" id="myHintTitle" paddingBottom="-10"/&amp;gt;&lt;br /&gt;&amp;lt;mx:Label color="#000000" fontSize="20" id="myHintText" text="{hintText}"/&amp;gt;&lt;br /&gt;&amp;lt;/mx:VBox&amp;gt;&lt;br /&gt;&amp;lt;/mx:HBox&amp;gt;  &lt;br /&gt;&amp;lt;/mx:Canvas&amp;gt;&lt;br /&gt;&amp;lt;/mx:Canvas&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;HintBubble Usage Example&lt;/b&gt;&lt;br /&gt;To use the HintBubble place the component somewhere in an accessible namespace for your application and place a tag similar to the following in your mxml file.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;HintBubble id="myHint" hintIcon="theme/arrow.png"&lt;br /&gt;  hintText="Click 'Search' to find more products." duration="5"&lt;br /&gt;  hintTitle="Help Tip" leftTo="40" bottom="65" left="1200" /&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;HintBubble Properties&lt;/b&gt;&lt;p&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;hintIcon : An icon to display in your hint bubble&lt;/li&gt;&lt;li&gt;hintText : Main text of your hint&lt;/li&gt;&lt;li&gt;hintTitle : Title for your hint bubble&lt;/li&gt;&lt;li&gt;left : Starting position of bubble ( ideally set somewhere off screen )&lt;/li&gt;&lt;li&gt;leftTo : Position the hint bubble slides to when toggled&lt;/li&gt;&lt;li&gt;bottom/top : fixed verticle position of bubble&lt;br /&gt;&lt;/li&gt;&lt;li&gt;duration : Seconds to display hint before automatically hiding&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-825352107713370189?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/825352107713370189/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/02/flex-hint-bubble-component.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/825352107713370189'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/825352107713370189'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/02/flex-hint-bubble-component.html' title='Flex Hint Bubble Component'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-6230266600777176041</id><published>2008-02-14T11:26:00.001-08:00</published><updated>2008-02-14T12:30:00.258-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><title type='text'>Auto Reloading a Flex Application</title><content type='html'>I have a flex application which runs on a touch screen and I want to have the application reset itself when no one is using it.&lt;br /&gt;&lt;br /&gt;To get this done I created a Timer that would reload my Flex app every 5 minutes and an event listener which would reset the timer everytime someone touched the screen (or clicked the app).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Example below.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;AppTimer.as  ActionScript Class File&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package&lt;br /&gt;{&lt;br /&gt;  import flash.events.Event;&lt;br /&gt;  import flash.events.TimerEvent;&lt;br /&gt;  import flash.utils.Timer;&lt;br /&gt;  import flash.net.URLRequest;&lt;br /&gt;  import flash.net.navigateToURL;&lt;br /&gt;&lt;br /&gt;  public class AppTimer&lt;br /&gt;  {&lt;br /&gt;   // Create Time Object to fire every minute for 5 minutes&lt;br /&gt;   public var myTimer:Timer = new Timer(60000,5);&lt;br /&gt;   &lt;br /&gt;      public function AppTimer()&lt;br /&gt;      {&lt;br /&gt;          // designates listeners for the completion event&lt;br /&gt;          myTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);&lt;br /&gt;        &lt;br /&gt;          // starts the timer ticking&lt;br /&gt;          myTimer.start();&lt;br /&gt;      }&lt;br /&gt;    &lt;br /&gt;      // Function restarts the timer.&lt;br /&gt;      public function resetTimer():void&lt;br /&gt;      {&lt;br /&gt;       myTimer.reset();&lt;br /&gt;       myTimer.start();&lt;br /&gt;      }&lt;br /&gt;    &lt;br /&gt;      // Function gets called when timer runs out. Reloads the page&lt;br /&gt;      public function onTimerComplete(evt:Event):void&lt;br /&gt;      {&lt;br /&gt;    var ref:URLRequest = new URLRequest("javascript:location.reload(true)");&lt;br /&gt;    navigateToURL(ref, "_self");      &lt;br /&gt; }&lt;br /&gt;    &lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;span style="font-weight: bold;"&gt;Main.MXML File&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br /&gt;&amp;lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"&lt;br /&gt; xmlns="*" creationComplete="initApp()"&amp;gt; &lt;br /&gt; &amp;lt;mx:Script&amp;gt;&lt;br /&gt;  &amp;lt;![CDATA[&lt;br /&gt;  &lt;br /&gt;  // Creates the AppTimer Object&lt;br /&gt;  public var myTimer:AppTimer = new AppTimer();&lt;br /&gt;   &lt;br /&gt;  // Function to run when app is created&lt;br /&gt;  private function initApp():void&lt;br /&gt;  {&lt;br /&gt;   // Add Event listner to track mouse clicks&lt;br /&gt;   application.addEventListener(MouseEvent.CLICK, globalClickEvent);     &lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  // Everytime a user clicks in the applicatoin run this function.&lt;br /&gt;  private function globalClickEvent(event:MouseEvent):void&lt;br /&gt;  {&lt;br /&gt;   myTimer.resetTimer(); // Call timer reset function&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  ]]&amp;gt;&lt;br /&gt; &amp;lt;/mx:Script&amp;gt;&lt;br /&gt; &amp;lt;mx:Panel width="100%" height="100%" title="My App with Timer"/&amp;gt;&lt;br /&gt;&amp;lt;/mx:Application&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;If anyone knows a better way to accomplish the same task I would be interested to hear about it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-6230266600777176041?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/6230266600777176041/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/02/auto-reloading-flex-application.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/6230266600777176041'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/6230266600777176041'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/02/auto-reloading-flex-application.html' title='Auto Reloading a Flex Application'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-612337941897292919</id><published>2008-02-13T14:13:00.001-08:00</published><updated>2008-02-14T12:30:16.681-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='forms'/><title type='text'>Form Validation in Flex</title><content type='html'>There are many example of how to use Flex built in form validators however most seem incomplete and frankly the basic use of validators in Flex are not the most user friendly.&lt;br /&gt;&lt;br /&gt;The best example I've found is over at blog examples. See link.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blog.flexexamples.com/2007/08/13/validating-flex-forms-using-the-validator-classes/"&gt;Click here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-612337941897292919?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/612337941897292919/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/02/form-validation-in-flex.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/612337941897292919'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/612337941897292919'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/02/form-validation-in-flex.html' title='Form Validation in Flex'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-2196201111917688697</id><published>2008-02-13T11:48:00.001-08:00</published><updated>2008-02-14T12:30:28.717-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><title type='text'>ActionScript Class for Global Variables in Flex</title><content type='html'>I've been reading several blogs and forums on how to implement global variables in a Flex application.  It's tough to find an effective example of how to do this as most threads/comments are flooded with people crying foul that good programming doesn't need global variables.&lt;br /&gt;&lt;br /&gt;While I agree for the most part I'm used to having some sort of config file in my applications which hold defined constants that are likely to change depending on the deployment or version of the application. Eg: In my php applications I keep database connection information in a config file so that i can easily switch between a development database or production database.&lt;br /&gt;&lt;br /&gt;The best solution I've found to do this in a Flex Application is to include in the root directory of your Flex application a ActionScript class that contains properties for all the constants or global variables you'll need to define.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Action Script : Settings.as&lt;br /&gt;&lt;/span&gt;&lt;pre&gt;&lt;br /&gt;package&lt;br /&gt;{&lt;br /&gt;  public class Settings&lt;br /&gt;  {&lt;br /&gt;    static public var SiteUrl:String="http://www.mydomain.com";&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Example MXML File Using Settings.as&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br /&gt;&amp;lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"&lt;br /&gt;xmlns="*"&amp;gt;&lt;br /&gt;  &amp;lt;mx:Script&amp;gt;&lt;br /&gt;    &amp;lt;![CDATA[&lt;br /&gt;    import mx.controls.Alert;&lt;br /&gt;    private function testSettings():void&lt;br /&gt;    {&lt;br /&gt;        Alert.show( Settings.SiteUrl );&lt;br /&gt;    }&lt;br /&gt;    ]]&amp;gt;&lt;br /&gt;  &amp;lt;/mx:Script&amp;gt;&lt;br /&gt;  &amp;lt;mx:Button label="test" click="testSettings()"/&amp;gt;&lt;br /&gt;&amp;lt;/mx:Application&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;Important things to make note of in this example you'll need  xmlns="*" in the opening tag of any MXML file or component which needs access to the properties of Settings.as.  You'll also need to make sure Settings.as is the root folder of your application.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-2196201111917688697?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/2196201111917688697/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/02/actionscript-class-for-global-variables.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/2196201111917688697'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/2196201111917688697'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/02/actionscript-class-for-global-variables.html' title='ActionScript Class for Global Variables in Flex'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6449760275592537835.post-2933269354348255060</id><published>2008-02-13T11:24:00.000-08:00</published><updated>2008-02-15T12:03:18.332-08:00</updated><title type='text'>Welcome</title><content type='html'>Time to get back into the process of writing, musing and keeping a blog.  I hope to provide some good tips regarding PHP, Flex, AJAX and other programming topics I'm working with.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6449760275592537835-2933269354348255060?l=kerkness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kerkness.blogspot.com/feeds/2933269354348255060/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kerkness.blogspot.com/2008/02/welcome.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/2933269354348255060'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6449760275592537835/posts/default/2933269354348255060'/><link rel='alternate' type='text/html' href='http://kerkness.blogspot.com/2008/02/welcome.html' title='Welcome'/><author><name>kerkness</name><uri>http://www.blogger.com/profile/12275084412180536585</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
