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

<channel>
	<title>VerySimple &#187; Flex</title>
	<atom:link href="http://verysimple.com/category/languages/flex/feed/" rel="self" type="application/rss+xml" />
	<link>http://verysimple.com</link>
	<description>Custom Software</description>
	<lastBuildDate>Tue, 15 May 2012 07:40:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Forcing a Flex VBox to scroll when necessary</title>
		<link>http://verysimple.com/2010/06/16/forcing-a-flex-vbox-to-scroll-when-necessary/</link>
		<comments>http://verysimple.com/2010/06/16/forcing-a-flex-vbox-to-scroll-when-necessary/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 13:07:12 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.verysimple.com/blog/?p=552</guid>
		<description><![CDATA[The VBox Flex container allows you to stack objects vertically.  If your VBox can have an unknown number of children and your app is not a fixed height, a weird behavior can occur where the VBox height expands beyond the height of it&#8217;s parent.  This usually causes scroll-bars to appear in unexpected places and possibly [...]]]></description>
			<content:encoded><![CDATA[<p>The VBox Flex container allows you to stack objects vertically.  If your VBox can have an unknown number of children and your app is not a fixed height, a weird behavior can occur where the VBox height expands beyond the height of it&#8217;s parent.  This usually causes scroll-bars to appear in unexpected places and possibly messes up your application layout.  Fixing this can be a nightmare of chasing down parent containers and trying to control their clipping.</p>
<p>Fortunately there&#8217;s a simple solution . Just set  <strong>minHeight=&#8221;0&#8243;</strong> and it will tell the component to not expand beyond the height of it&#8217;s Parent.  This works for any container with a vertical layout as well including  Panels</p>
<p>There&#8217;s additionally an <strong>autoLayout</strong> property which can be set to false, however I can&#8217;t get consistent results with that.  It seems like there would be some more intuitive property name to control this behavior, but at least there is a solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://verysimple.com/2010/06/16/forcing-a-flex-vbox-to-scroll-when-necessary/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Adding and Removing Children from a Flex XMLList</title>
		<link>http://verysimple.com/2010/03/22/adding-and-removing-children-from-a-flex-xmllist/</link>
		<comments>http://verysimple.com/2010/03/22/adding-and-removing-children-from-a-flex-xmllist/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 05:21:20 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[actionscript]]></category>

		<guid isPermaLink="false">http://www.verysimple.com/blog/?p=527</guid>
		<description><![CDATA[I seem to always forget how this is done and for whatever reason there&#8217;s a lot of posts floating around with confusing information.  The XMLList doesn&#8217;t have any methods for adding and removing items, or even obtaining items at a specific index.  Adding and removing children from an XMLList in Flex is actually simple, though. [...]]]></description>
			<content:encoded><![CDATA[<p>I seem to always forget how this is done and for whatever reason there&#8217;s a lot of posts floating around with confusing information.  The XMLList doesn&#8217;t have any methods for adding and removing items, or even obtaining items at a specific index.  Adding and removing children from an XMLList in Flex is actually simple, though.   The XMLList can be treated as if it were an Array.</p>
<pre>
// create an XML object with one child.
var parentXml:XML = ;

// parentXml.child is an XMLList.  add two new elements
parentXml.child[parentXml.child.length()] = ;
parentXml.child[parentXml.child.length()] = ;

// remove the 2nd item
delete parentXml.child[1];
</pre>
<p>Put this code inside a function and step through it in the debugger to see what&#8217;s happening.</p>
<p>One thing to note is that if you are binding controls to &#8220;parentXml&#8221;, the UI doens&#8217;t necessarily receive update events when the child nodes are manipulated.  In this case you may have to dispatch an event to force the UI to re-call the getter for parentXml.  Although, that is a subject for another post&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://verysimple.com/2010/03/22/adding-and-removing-children-from-a-flex-xmllist/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Install PDT Plugin in FlexBuilder 3</title>
		<link>http://verysimple.com/2010/02/18/install-pdt-plugin-in-flexbuilder-3/</link>
		<comments>http://verysimple.com/2010/02/18/install-pdt-plugin-in-flexbuilder-3/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 01:26:10 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.verysimple.com/blog/?p=495</guid>
		<description><![CDATA[Installing PDT (PHP Development Tools) Plugin for FlexBuilder allows you to work with PHP projects within the FlexBuilder environment.  This is useful if you are using AMFPHP, WebORB for PHP or some other PHP-based remote server.  There are similar instructions posted elsewhere, however I found that they have become outdated.  Because FlexBuilder 3 is based [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_499" class="wp-caption alignright" style="width: 310px"><a href="http://verysimple.com/wp-content/uploads/2010/02/pdt1.gif" rel="shadowbox[sbpost-495];player=img;"><img class="size-medium wp-image-499" src="http://www.verysimple.com/blog/wp-content/uploads/2010/02/pdt1-300x180.gif" alt="" width="300" height="180" /></a><p class="wp-caption-text">PDT Screenshot</p></div>
<p>Installing <a href="http://www.eclipse.org/pdt/" target="_blank">PDT</a> (PHP Development Tools) Plugin for FlexBuilder allows you to work with PHP projects within the FlexBuilder environment.  This is useful if you are using <a href="http://www.amfphp.org/" target="_blank">AMFPHP</a>, <a href="http://www.themidnightcoders.com/" target="_blank">WebORB for PHP</a> or some other PHP-based remote server.  There are similar instructions posted elsewhere, however I found that they have become outdated.  Because FlexBuilder 3 is based on an older release of Eclipse, you now have to specifically install older versions of the PDT files.</p>
<p>Note &#8211; If you are using a recent version of Eclipse with FlexBuilder plugin, or are using FlexBuilder 4 then you should not follow these instructions &#8211; instead install the most recent version of PDT.  These instructions are only necessary for FlexBuilder 3 Stand-Alone edition.</p>
<h2>Installing PDT:</h2>
<ol>
<li>Open FlexBuilder 3 menu Help-&gt;Software Updates-&gt;Find and Install</li>
<li>Search for new feature to install</li>
<li>Click &#8220;New Remote Site&#8221; and enter the following:
<ul>
<li>Name: PDT 1.x</li>
<li>URL: http://download.eclipse.org/tools/pdt/updates/<br />
(<span style="color: #800000;">note is that this URL is to the old 1.x update site</span>)</li>
</ul>
</li>
<li>After adding the site, click OK and select the following two Sites to include:
<ul>
<li>Europa Discovery Site</li>
<li>PDT 1.x</li>
</ul>
</li>
<li>Click &#8220;Finish&#8221; to begin searching for updates</li>
<li>Once the results are displayed, un-check the box that says &#8220;Show latest version of a feature only&#8221;</li>
<li>Expand PDT 1.x and select <strong>PDT SDK 1.0.3</strong><br />
(<span style="color: #800000;">important &#8211; do not select a higher version than 1.0.3</span>)</li>
<li>After you have selected PDT SDK, you may have required libraries missing.  You can try at this point clicking &#8220;Select Required&#8221; and they will be automatically selected from the Europa Discovery Site.  However, this sometimes causes FlexBuilder to lock up.  In which case, you have to force quit FlexBuilder, start the process over and manually select the required libraries which are:
<ul>
<li>Graphical Editors and Frameworks-&gt;Graphical Editing Framework 3.3.2</li>
<li>Java Development-&gt;Eclipse Java Development Tools 3.3.2</li>
<li>Models and Model Development-&gt;Eclipse Modeling Framework (EMF) Runtime + End-User Tools 2.3.2</li>
<li>Models and Model Development-&gt;XML Schema Infoset Model (XSD) Extender SDK 2.3.2</li>
<li> Web and JEE Development-&gt;Web Standard Tools (WST) Project 2.0.2<br />
(<span style="color: #800000;">if any of these libraries are missing and do not appear, it probably means that you have already installed them</span>)</li>
</ul>
</li>
<li>You should now be able to click &#8220;Finish&#8221; and agree to the license.  You can then restart the app and begin working with PHP project within FlexBuilder.</li>
</ol>
<h2>Configure Smarty (TPL) Template Editing</h2>
<p>There is another project called <a href="http://code.google.com/p/smartypdt/" target="_blank">smartypdt</a> &#8211; however it doesn&#8217;t seem to be compatible with the older version of PDT &#8211; at least I couldn&#8217;t get it working.  Instead I simply configure TPL files to open using the PHP editor:</p>
<ol>
<li>Open the menu Window-&gt;Preferences</li>
<li>Navigate in preferences to General-&gt;Content Types</li>
<li>Expand the Text node and highlight &#8220;PHP Content Types&#8221;</li>
<li>In the File associations list, add *.tpl</li>
</ol>
<p>At this point you should be able to open a PHP folder and edit both PHP and TPL files.  If you configure your include path correctly, you should have code insight on your PHP classes and functions.</p>
]]></content:encoded>
			<wfw:commentRss>http://verysimple.com/2010/02/18/install-pdt-plugin-in-flexbuilder-3/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Installing Flex Formatter Plugin</title>
		<link>http://verysimple.com/2010/01/12/installing-flex-formatter-plugin/</link>
		<comments>http://verysimple.com/2010/01/12/installing-flex-formatter-plugin/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 03:00:06 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.verysimple.com/blog/?p=474</guid>
		<description><![CDATA[If you like your code clean and with proper doc block comments, Flex Formatter is a handy plugin for Flex Builder 3.  The plugin installs in Eclipse by simply dragging the files into the plugin directory, however with Flex Builder you can install from a remote install site hosted on the google code site. To [...]]]></description>
			<content:encoded><![CDATA[<p>If you like your code clean and with proper doc block comments, <a href="http://sourceforge.net/projects/flexformatter/" target="_blank">Flex Formatter</a> is a handy plugin for Flex Builder 3.   The plugin installs in Eclipse by simply dragging the files into the plugin directory, however with Flex Builder you can install from a remote install site hosted on the google code site.</p>
<p>To install in Flex Builder 3:</p>
<ol>
<li>Help -&gt; Software Updates -&gt; Find and Install&#8230;</li>
<li>Choose &#8220;Search for new features to install&#8221; and click Next</li>
<li>Click &#8220;New Remote Site&#8221; button and enter the following in the dialog:
<ul>
<li>Name = Flex Pretty Print Command:</li>
<li>URL = http://flexformatter.googlecode.com/svn/trunk/FlexFormatter/FlexPrettyPrintCommandUpdateSite/</li>
</ul>
</li>
<li>Click Finish and complete the process of installing the plugin</li>
</ol>
<p><a href="http://verysimple.com/wp-content/uploads/2010/01/flexformatter.png" rel="shadowbox[sbpost-474];player=img;"><img class="size-full wp-image-475 alignright" src="http://verysimple.com/wp-content/uploads/2010/01/flexformatter.png" alt="" width="177" height="129" /></a>After installing and restarting Flex Builder you&#8217;ll have five new icons in your toolbar.  These allow you to add doc block and clean up spacing for selected sections or an entire file.</p>
<p>The settings for Flex Formatter are found along with all of the other Eclipse preferences.  You can choose to have files formatted automatically on save, specify locations to exclude and a few other options.</p>
<p>The Auto Format settings allows you to configure the template used when cleaning your code.  This allows you to specify exactly how you like your files formatted.  This is an extremely useful feature for organizations that enforce a certain code style.</p>
]]></content:encoded>
			<wfw:commentRss>http://verysimple.com/2010/01/12/installing-flex-formatter-plugin/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Flex: All your dates are belong to us</title>
		<link>http://verysimple.com/2010/01/12/flex-all-your-dates-are-belong-to-us/</link>
		<comments>http://verysimple.com/2010/01/12/flex-all-your-dates-are-belong-to-us/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 20:37:59 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.verysimple.com/blog/?p=460</guid>
		<description><![CDATA[I feel like I&#8217;m constantly ranting about Flex&#8217;s implementation of Dates.  This week I just discovered a new &#8220;feature&#8221; that is even more annoying to me. Without going over it all again, Flex dates are timezone aware and the UTC offset is automatically calculated for you.  The problem is that you are locked into displaying [...]]]></description>
			<content:encoded><![CDATA[<p>I feel like I&#8217;m constantly <a href="http://www.verysimple.com/blog/2009/11/16/confusing-timezone-offset-functionality-in-flex/">ranting</a> about Flex&#8217;s implementation of Dates.  This week I just discovered a new &#8220;feature&#8221; that is even more annoying to me.</p>
<p>Without going over it all again, Flex dates are timezone aware and the UTC offset is automatically calculated for you.  The problem is that you are locked into displaying the timezone of the local system clock unless you hack the date values.  But when sending over the wire to the server the date is automatically converted into the server&#8217;s timezone without telling you what timezone the Date is supposed to be in.  In other words, you get &#8220;8:00 PM UTC&#8221; but you have no ideas what timezone that pertains to, so you don&#8217;t know whether the Date is actually supposed to read 2:00 PM EST, 1:00 PM CST, or 11:00 AM PST.  Technically those are all the same &#8220;time,&#8221; but in some cases you need to work in timezones other than your own.</p>
<p>Anyway, I implemented my own solution for this issue last year, but was going on the assumption that the timezone offset is based only on the local system clock.  What I found out last week is that the timezone offset will actually change if you create a Date in the past or future where DST has kicked in/out.  In other words, every Date has it&#8217;s own offset.  I&#8217;ll admit that could probably be handy however if you are trying to neutralize the timezone changes that Flex does, it only makes your job that much harder.  I had not been expecting this and so we had to do some modification to our client to correctly handle DST changes at the server.</p>
<p>Below is some code to demonstrate how the timezone offset changes with DST, even though your system clock is still the same.  Note that you need to set your system clock to a timezone in the US that observes daylight savings time on March 15.  (Chicago for example).  If you&#8217;re in the UK the switch is March 28, so you can change the dates to March 27 &amp; March 28 to see the effect.  Notice that the timeZoneOffset property is different between the two dates.  I suppose this makes sense but it definitely creates hassles on the server side.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&lt;</span>?<span style="color: #0066CC;">xml</span> <span style="color: #0066CC;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;</span>mx:WindowedApplication 
 xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> 
 layout=<span style="color: #ff0000;">&quot;vertical&quot;</span> 
 <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;700&quot;</span>
 <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;1000&quot;</span>
 creationComplete=<span style="color: #ff0000;">&quot;onCreationComplete()&quot;</span>
<span style="color: #66cc66;">&gt;</span>
&nbsp;
<span style="color: #66cc66;">&lt;</span>mx:Script<span style="color: #66cc66;">&gt;</span>
 <span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span>
  <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> onCreationComplete<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
  <span style="color: #66cc66;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">var</span> d1:<span style="color: #0066CC;">Date</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Date</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">2010</span>,<span style="color: #cc66cc;">2</span>,<span style="color: #cc66cc;">14</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// march 14</span>
   result1.<span style="color: #0066CC;">text</span> =  <span style="color: #ff0000;">&quot;MARCH 14: &quot;</span>
    + d1.<span style="color: #006600;">toDateString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> 
    + <span style="color: #ff0000;">&quot; OFFSET = &quot;</span> 
    + d1.<span style="color: #006600;">timezoneOffset</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
   <span style="color: #000000; font-weight: bold;">var</span> d2:<span style="color: #0066CC;">Date</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Date</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">2010</span>,<span style="color: #cc66cc;">2</span>,<span style="color: #cc66cc;">15</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// march 15</span>
   result2.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">&quot;MARCH 15: &quot;</span>
    + d2.<span style="color: #006600;">toDateString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> 
    + <span style="color: #ff0000;">&quot; OFFSET = &quot;</span> 
    + d2.<span style="color: #006600;">timezoneOffset</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #66cc66;">&#125;</span>
 <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;/</span>mx:Script<span style="color: #66cc66;">&gt;</span>
&nbsp;
<span style="color: #66cc66;">&lt;</span>mx:Label id=<span style="color: #ff0000;">&quot;result1&quot;</span> <span style="color: #66cc66;">/&gt;</span>
<span style="color: #66cc66;">&lt;</span>mx:Label id=<span style="color: #ff0000;">&quot;result2&quot;</span>  <span style="color: #66cc66;">/&gt;</span>
&nbsp;
<span style="color: #66cc66;">&lt;/</span>mx:WindowedApplication<span style="color: #66cc66;">&gt;</span></pre></div></div>

<p>I&#8217;m interested in anybody else&#8217;s ideas or solutions as to how you work with dates across timezones in Flex.  Please post a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://verysimple.com/2010/01/12/flex-all-your-dates-are-belong-to-us/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>AIR 2 &#8211; Adobe Has Removed the Training Wheels</title>
		<link>http://verysimple.com/2009/11/17/air-2-adobe-has-removed-the-training-wheels/</link>
		<comments>http://verysimple.com/2009/11/17/air-2-adobe-has-removed-the-training-wheels/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 04:33:43 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.verysimple.com/blog/?p=438</guid>
		<description><![CDATA[I was very excited to read Adobe&#8217;s beta release notes about AIR 2.  AIR gives developers a very easy way to develop good looking, cross-platform applications.  The problem is that, in order to ensure all applications are cross-platform, Adobe was very stingy about how much you can reach out and interact with the underlying OS. [...]]]></description>
			<content:encoded><![CDATA[<p>I was very excited to read Adobe&#8217;s beta release notes about <a href="http://labs.adobe.com/technologies/air2/" target="_blank">AIR 2</a>.  AIR gives developers a very easy way to develop good looking, cross-platform applications.  The problem is that, in order to ensure all applications are cross-platform, Adobe was very stingy about how much you can reach out and interact with the underlying OS.</p>
<p>Those of us investing time in developing AIR apps have been working with one hand tied behind our back, unable to do simple things like even launch a document in MS Word, let alone utilize the thousands of shell commands available inside the OS.  (Well, there are various alternatives and hacks to do similar things, but still&#8230;)  Simple functions like burning a CD or encoding an audio file were simply not possible because the underlying libraries that perform these functions are not accessible within the AIR sandbox &#8211; even if those libraries themselves are cross platform.  None of the other major cross-platform environments have this limitation.  AIR was designed to connect to a server via HTTP in order to do these types of things, which is great for a web-based solution but not so for a desktop solution.  So AIR sometimes gets a bad rap as a a &#8220;widget&#8221; development platform that is good for eye candy, but not able to have deep interaction with the OS.</p>
<p>With AIR 2 Adobe decided to lift even more of the constraints and allow developer to execute native commands.  What this means is that we might start seeing very handsome AIR apps that serve as SVN front-ends, MP3 encoders, network monitoring tools, disk utilities, etc.   AIR will be able to interact with other software on the machine such as legacy enterprise apps.  I know this was not Adobe&#8217;s original vision for AIR, but  I have always thought otherwise and I&#8217;m very glad Adobe decided to loosen the shackles.  There are several other interesting improvements in version 2, but I think the native call feature has the potential to open the floodgates for enterprise developers.</p>
<p>With the new functionality comes the inevitable risk that some AIR apps will only run on one platform, or they may require you to install an OS-specific component in addition to the AIR application.  It will also be possible to build an AIR app that requires a certain Windows-only or OSX-only command.  However, thoughtful developers will at least be able to make that choice for themselves.</p>
<p>AIR 2 is out in beta now and end users will start seeing new applications when the public release launches in the first half of 2010.</p>
]]></content:encoded>
			<wfw:commentRss>http://verysimple.com/2009/11/17/air-2-adobe-has-removed-the-training-wheels/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Confusing TimeZone Offset Functionality in Flex</title>
		<link>http://verysimple.com/2009/11/16/confusing-timezone-offset-functionality-in-flex/</link>
		<comments>http://verysimple.com/2009/11/16/confusing-timezone-offset-functionality-in-flex/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 20:26:44 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.verysimple.com/blog/?p=427</guid>
		<description><![CDATA[The timezone functionality in Flex (as of SDK 3.4.1) makes me wonder if this is the person who designed this behavior (I kid because I love).  It&#8217;s clear that the functionality was designed to magically handle the difficult subject of timezone and I appreciate that.  The problem is that, athough Flex goes through the trouble [...]]]></description>
			<content:encoded><![CDATA[<p>The timezone functionality in Flex (as of SDK 3.4.1) makes me wonder if <a href="http://www.youtube.com/watch?v=8pzV5K8vZQc" target="_blank">this</a> is the person who designed this behavior (I kid because I love).  It&#8217;s clear that the functionality was designed to magically handle the difficult subject of timezone and I appreciate that.  The problem is that, athough Flex goes through the trouble of calculating the UTC time automatically, you have no clean way to obtain input or display date values in anything other than the local system time.  So in order to display dates in other timezones, you actually have to enter incorrect UTC values and &#8220;trick&#8221; flex into showing the value that you want.  Additionally the remote server communication is very confusing and inconsistent with local (AIR) db storage.  The server has no way of knowing what the real value of your Date is unless you also provide it with the local clients current timezone offset.  Meanwhile, dates saved to a local DB have no timezone info stored with them at all.  Saving dates locally (AIR) can be downright dangerous if the system timezone changes while the app is open, including daylight savings changes.</p>
<p>If this is something that has caused you grief, I encourage you to <a href="https://bugs.adobe.com/jira/browse/FP-175" target="_blank">vote for the issue to be fixed in the Flex SDK</a>.</p>
<p><span id="more-427"></span></p>
<p>The crux of the problem is a combination of three things.  First that all Dates are timezone aware, yet they are &#8220;locked&#8221; to the local system timezone and the offset property is read-only.  The second is that all of the Date formatting functions and Date-related UI controls have no concept of timezone.  The third is that the Date class is marked Final, so there is no way for developers to extend the class and override the default behavior.  It almost seems like it was an intentional effort to prevent any apps from displaying anything other than local time, which is weird.  The unfortunate side effect of this design is that it forces developers to use very ugly hacks.</p>
<p>In my mind there would be two &#8220;correct&#8221; way to deal with this.  The first would be to allow the timezone offset property of a Date to be writable.  This would allow developers to store the correct UTC time but specify the offset of their choosing for input and display.  To me this makes the most sense and I don&#8217;t understand at all why it isn&#8217;t allowed unless there is some low-level feature of the Flash engine that makes this difficult.</p>
<p>A less optimal solution, if changing the timezone is not possible, would be to re-write all of the Date related UI controls and functions (formatters, etc) so that they can accept input and display output in a different timezone from the local system.  This would be a ton of work and you&#8217;d probably run into problems with third-party components that weren&#8217;t written the same way.  This would at least allow you to keep your date values stored correctly, though.</p>
<p>What developers are currently forced to do instead is to actually create Dates with incorrect UTC values in order to get them to display correctly.  If I have a meeting in NY at 5PM but I am physically in PST, I have to set the time to 5PM PST in order to show it on a calendar 5PM.  But 5PM PST is actually 8PM EST so this is not technically correct &#8211; the UTC value is off by 3 hours.  Flex of course wants this item to show up on my calendar as 2PM PST because it does not think a user would ever want to see time written in it&#8217;s relevant timezone.  When I pass this to the server, of course, I have to neutralize the senders timezone offset on the way in, and then account for the receiver&#8217;s timezone on the way out.</p>
<p>For now I&#8217;ve managed to work-around all of these issues, however it is a constant worry for my team since our users are managing events that take place around the world, some of them traveling to a new timezone every day.  I hope that Adobe will address this seemingly minor issue in a future release.</p>
]]></content:encoded>
			<wfw:commentRss>http://verysimple.com/2009/11/16/confusing-timezone-offset-functionality-in-flex/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Flex Remoting and WebORB Mysterious Error Messages</title>
		<link>http://verysimple.com/2009/07/01/flex-remoting-and-weborb-mysterious-error-messages/</link>
		<comments>http://verysimple.com/2009/07/01/flex-remoting-and-weborb-mysterious-error-messages/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 20:37:05 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.verysimple.com/blog/?p=390</guid>
		<description><![CDATA[If you work with Flex remoting and WebORB, you are probably familiar with the following errors: NetConnection.Call.Failed: HTTP: Status 500 Channel Disconnected You may have tried directing your browser to weborb.php only to get this message: &#8220;WebORB v3.5.0 Fatal error: Call to a member function getServiceURI()&#8221; The getServiceURI message is actually a red herring error [...]]]></description>
			<content:encoded><![CDATA[<p>If you work with Flex remoting and WebORB, you are probably familiar with the following errors:</p>
<ul>
<li>NetConnection.Call.Failed: HTTP: Status 500</li>
<li>Channel Disconnected</li>
</ul>
<p>You may have tried directing your browser to weborb.php only to get this message: &#8220;WebORB v3.5.0 <strong>Fatal error</strong>:  Call to a member function getServiceURI()&#8221;</p>
<p>The getServiceURI message is actually a red herring error message.  This simply occurs because weborb.php is expecting the raw headers to contain Flash remoting AMF message data.  Your browser is just making a normal HTTP GET and doesn&#8217;t know anything about AMF.   So weborb.php winds up with a null object on which it tries to call getServiceURI().  I wouldn&#8217;t be surprised to see a future release of WebORB that catches this error, even though it isn&#8217;t the purpose of this particular file to run inside a browser.</p>
<p><span id="more-390"></span></p>
<p>So, you are probably frustrated because you were trying to figure out what is wrong with your install and why you are getting the connection and/or channel errors.  These errors are almost always the result of a PHP compile-time error.  PHP5 itself is rather inconsistent in the way it handles different types of errors.  You may have noticed that it&#8217;s impossible to catch a syntax error or a bad path in a require_once() statement, for example.  If an include file is missing, PHP craps out before you have a chance to do any error handling.  You can only catch and handle run-time errors within your PHP code.  You may be tempted to think that WebORB should be able to catch these errors and return a more useful message to Flex, however the PHP engine stops executing before it even gives your code or WebORB a chance to handle anything.  It&#8217;s kinda the equivelant of having a syntax error in Java or C code that causes your app to not compile.  It doesn&#8217;t matter what type of error trapping code you write &#8211; if you code doesnt&#8217; even compile, it doesn&#8217;t even get the chance to run.</p>
<p>When any part of either your service or WebORB encounters a compile-time error, it instantly dies and, depending on your server config, will write out the error details to STDOUT (which shows in a browser) but what it does not do is return a proper AMF message to the client.  If you were to look at the output of the PHP page, most likely you would instantly see cause of the error.  However Flex/Flash seemingly ignores the output of the page and it only processes the headers returned by the server (ie 500 error).  So PHP is outputing the details of the error but Flex blocks you from reading it.</p>
<p><em>UPDATE: I now use <a href="http://www.themidnightcoders.com" target="_blank">App Puncher</a> to view error messages now.  A network proxy or packet inspector would probably work as well.  My original info below is still here in case you want to trace down errors by hand.</em></p>
<p>To figure these errors out, I try to start debugging with a simple function that doesn&#8217;t do anything.  Slowly, step-by-step I start re-enabling code until I locate the source of the channel disconnect by process of elimination.  Other times I write a debug page in PHP and call the function in question directly.  (This isn&#8217;t always easy if Flex is passing in complex structures, however, it can be worth the effort sometimes).</p>
<p>I&#8217;ve noticed these things to be sure-fire causes:</p>
<ul>
<li>require_once statement with file missing (or PHP include path not set right).  Note that if you are dynamically calculating the abolute path of the current working directory that it will be different when you are running via the &#8220;Management Console&#8221; than if you call your service directly from Flex.  This is a dead giveaway if it runs in one, but not the other.</li>
<li>passing in an argument to a method that does not match the declared PHP type.  You can detect this by simply removing your type declaration in your methods and see if the data comes through.  This could indicate a mapping problem or an unsupported type.</li>
<li>syntax error that causes PHP compile-time error.  This can be any type of silly syntax error.  These are usually easy to see if you create a server-side page that calls your service method.</li>
<li>If the WebORB examples work, but not your own services, it&#8217;s pretty much a giveaway that PHP is crashing somewhere inside your own service code and not the WebORB installation.</li>
<li>If you can&#8217;t even get the WebORB examples to work, then there is a good chance that editing PHP.ini will be required.  If that&#8217;s the case, hitting weborb.php with your browser can sometimes show you what&#8217;s wrong &#8211; just realize that any errors mentioning either getServiceURI() and FlashorbBinaryReader are due to the missing AMF headers that your browser didn&#8217;t send and are not the problem.</li>
</ul>
<p>If you have a better way of debugging, please post a reply.  This can be an extremely frustrating error to chase down and I would welcome any suggestions.</p>
]]></content:encoded>
			<wfw:commentRss>http://verysimple.com/2009/07/01/flex-remoting-and-weborb-mysterious-error-messages/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>FlipCard 2.0 With Source Released</title>
		<link>http://verysimple.com/2009/04/08/flipcard-2/</link>
		<comments>http://verysimple.com/2009/04/08/flipcard-2/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 01:04:09 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Products]]></category>

		<guid isPermaLink="false">http://www.verysimple.com/blog/?p=351</guid>
		<description><![CDATA[Last year I posted a FlipCard component for Flex that allows you to place UI Controls on the front and back of a 3D &#8220;card&#8221; that can be flipped by the user.  It gives the user the visual effect that there are settings or options on the backside of the page, form, etc. FlipCard 2 [...]]]></description>
			<content:encoded><![CDATA[<p>Last year I posted a FlipCard component for Flex that allows you to place UI Controls on the front and back of a 3D &#8220;card&#8221; that can be flipped by the user.  It gives the user the visual effect that there are settings or options on the backside of the page, form, etc.</p>
<p><a href="http://code.google.com/p/flipcard/" target="_blank"><img class="size-full wp-image-118" src="http://www.verysimple.com/flex/flipcard/screenshot.png" alt="FlipCard ScreenShot" /></a></p>
<p><span id="more-351"></span>FlipCard 2 has been rewritten from scratch to include various suggested features:</p>
<p><strong>Download FlipCard from the <a href="http://code.google.com/p/flipcard/" target="_blank">FlipCard Project Page</a> at Google Code.<br />
</strong></p>
<p>The full source code was not included in the initial release due to the fact that it was mixed in with code from another application.  I finally set aside some time to re-factor and package it up into it&#8217;s own project.  I&#8217;m releasing the code in hopes that others might contribute and improve the component, so please feel free to submit code patches, documentation, skins, etc.</p>
<p>FlipCard v1 was written in MXML and used various tricks to allow child components to be added.  Unfortunately this made it impossible to view the front and back side contents in Design view.  The component is rewritten in 100% ActionScript and works in Design view, including the ability to edit the inner contents as well.  FlipCard inherits from ViewStack and behaves as such in Design view, allowing you to change the selectedIndex and view the back side.  Design view currently has some issues in that you can &#8220;flip&#8221; the card too many times and the child items go out of view, however toggling out and back in to Design view is a simple workaround.</p>
<p>The control is now much easier to customize and the flip button is no longer hard-coded into the FlipCard.  A FlipCardContainer class is include that will automatically generate a button, or you can create your own buttons to toggle the flip card via ActionScript.</p>
<p>The initial version also used code that had some memory leak issues and those have been fixed as well.</p>
<p>Please feel free to comment below, however if you have bug reports or feature requests, I ask that you post them on the google project page and not this blog post.</p>
]]></content:encoded>
			<wfw:commentRss>http://verysimple.com/2009/04/08/flipcard-2/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Binding Flex TextInput UI Controls to a DataProvider</title>
		<link>http://verysimple.com/2008/09/16/binding-flex-textinput-ui-controls-to-a-dataprovider/</link>
		<comments>http://verysimple.com/2008/09/16/binding-flex-textinput-ui-controls-to-a-dataprovider/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 22:33:25 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[*NIX]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.verysimple.com/blog/?p=219</guid>
		<description><![CDATA[In Flex when you bind data to a UI control like a DataGrid, the grid cells refresh every time the dataSource changes. The reverse is also true if the DataGrid is enabled for editing. That is, the dataSource is also updated when you edit a cell. The TextInput can be bound as well so that [...]]]></description>
			<content:encoded><![CDATA[<p>In Flex when you bind data to a UI control like a DataGrid, the grid cells refresh every time the dataSource changes.  The reverse is also true if the DataGrid is enabled for editing.  That is, the dataSource is also updated when you edit a cell.</p>
<p>The TextInput can be bound as well so that when the dataSource changes, the value of the TextInput will automatically update.  However, unlike the DataGrid, changing the text of the TextInput will not automatically update the dataSource.  Take the following code for example (assuming &#8220;source&#8221; is a String variable):</p>

<div class="wp_syntax"><div class="code"><pre class="as3" style="font-family:monospace;">&lt;mx:TextInput id=&quot;text1&quot; text=&quot;{source}&quot; change=&quot;{source= text1.text}&quot; /&gt;</pre></div></div>

<p>When the TextInput is changed, the value of <em>source</em> remains the same.  It&#8217;s only bound one-way.  If you want the value of <em>source</em> to be updated when TextInput changes, it&#8217;s actually easy, but there are at least five (5) different ways to do it of which I know.  For the most straight-forward two-way binding, you could update the TextInput code like so:</p>
<p>Technically <em>source</em> is not bound to the TextInput, but it does produce the desired result.  <em>source</em> is updated manually whenever the valueCommit event fires.  The <strong>valueCommit</strong> event fires when the TextInput text has been changed <em>onBlur</em> (ie when when TextInput loses focus).  If you prefer source to be updated on every key stroke, you can change <strong>valueCommit</strong> to <strong>change</strong> instead and the update will occur on every <em>keyUp</em>.  If I&#8217;m updating a database or making a service call, I prefer valueCommit so the back-end code only fires once after the user is finished updating the field.  If the TextInput is an ajax-style auto complete or lookup, the change event might be more desirable so the application can react after each key stroke.</p>
<p>As I mentioned there are five methods to do this.  You can bind controls using Flex&#8217;s binding features in either MX code or ActionScript.  Depending on your application one may be better than the rest as far as keeping your code clean and consistent.  For the most part they all achieve the same result.  Below is source code that demonstrates all five techniques:</p>

<div class="wp_syntax"><div class="code"><pre class="as3" style="font-family:monospace;">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:WindowedApplication xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;vertical&quot; creationComplete=&quot;{init()}&quot;&gt;
	&lt;mx:Script&gt;
		&lt;![CDATA[
			import mx.binding.utils.BindingUtils;
			import mx.binding.utils.ChangeWatcher;
&nbsp;
			/**
			 * Called at creation complete and initializes all of the examples
			 */
			private function init():void
			{
				this.initExample2();
				this.initExample3();
				this.initExample4();
				this.initExample5();
			}
&nbsp;
			/**
			 * Example 1: simple inline binding (see the MXML)
			 * -----------------------------------------------------------------------
			 */
&nbsp;
			[Bindable]
			private var value1:String = &quot;example 1&quot;;
&nbsp;
			/**
			 * Example 2: use ChangeWatcher to assign a change watcher to text2.text
			 * -----------------------------------------------------------------------
			 */
&nbsp;
			[Bindable]
			public var value2:String = &quot;example 2&quot;;
&nbsp;
			private var watcher2:ChangeWatcher;
&nbsp;
			public function initExample2():void
			{
				watcher2 = ChangeWatcher.watch(text2,&quot;text&quot;,text2changed);
			}
&nbsp;
			/**
			 * notice that the argument is an event
			 */
			public function text2changed(event:Event):void
			{
				this.value2 = (event.currentTarget as TextInput).text;
			}
&nbsp;
			/**
			 * Example 3: use BindingUtils to bind a change watcher to the text3.text setter
			 * -----------------------------------------------------------------------
			 */
&nbsp;
			[Bindable]
			private var value3:String = &quot;example 3&quot;;
&nbsp;
			private var watcher3:ChangeWatcher;
&nbsp;
			public function initExample3():void
			{
				watcher3 = BindingUtils.bindSetter(text3changed,text3,&quot;text&quot;);
			}
&nbsp;
			/**
			 * notice that the function argument is a string (the value of text3.text)
			 */
			public function text3changed(val:String):void
			{
				this.value3 = val;
			}
&nbsp;
			/**
			 * Example 4: Use BindingUtils to bind text4.text to this.value4 (notice value4 has to be public)
			 * -----------------------------------------------------------------------
			 */
&nbsp;
			[Bindable]
			public var value4:String = &quot;example 4&quot;;
&nbsp;
			private var watcher4:ChangeWatcher;
&nbsp;
			public function initExample4():void
			{
				watcher4 = BindingUtils.bindProperty(this, &quot;value4&quot;, text4, &quot;text&quot;);
			}
&nbsp;
			/**
			 * Example 5: using MX:Binding in the MXML (see below)
			 * -----------------------------------------------------------------------
			 */
&nbsp;
			[Bindable]
			private var value5:String = &quot;example 5&quot;;
&nbsp;
			public function initExample5():void
			{
				text5.text = this.value5;
			}
&nbsp;
		]]&gt;
	&lt;/mx:Script&gt;
&nbsp;
	&lt;mx:HBox&gt;
		&lt;mx:TextInput id=&quot;text1&quot; text=&quot;{this.value1}&quot; change=&quot;{this.value1 = text1.text}&quot; /&gt;
		&lt;mx:Label id=&quot;label1&quot; text=&quot;{this.value1}&quot; /&gt;
	&lt;/mx:HBox&gt;
&nbsp;
	&lt;mx:HBox&gt;
		&lt;mx:TextInput id=&quot;text2&quot; text=&quot;{this.value2}&quot; /&gt;
		&lt;mx:Label id=&quot;label2&quot; text=&quot;{this.value2}&quot; /&gt;
	&lt;/mx:HBox&gt;
&nbsp;
	&lt;mx:HBox&gt;
		&lt;mx:TextInput id=&quot;text3&quot; text=&quot;{this.value3}&quot; /&gt;
		&lt;mx:Label id=&quot;label3&quot; text=&quot;{this.value3}&quot; /&gt;
	&lt;/mx:HBox&gt;
&nbsp;
	&lt;mx:HBox&gt;
		&lt;mx:TextInput id=&quot;text4&quot; text=&quot;{this.value4}&quot; /&gt;
		&lt;mx:Label id=&quot;label4&quot; text=&quot;{this.value4}&quot; /&gt;
	&lt;/mx:HBox&gt;
&nbsp;
	&lt;mx:HBox&gt;
		&lt;mx:TextInput id=&quot;text5&quot; /&gt;
		&lt;mx:Label id=&quot;label5&quot; text=&quot;{this.value5}&quot; /&gt;
	&lt;/mx:HBox&gt;
&nbsp;
	&lt;!-- Configure the binding here in MXML --&gt;
	&lt;mx:Binding source=&quot;text5.text&quot; destination=&quot;this.value5&quot; /&gt;
&nbsp;
&lt;/mx:WindowedApplication&gt;</pre></div></div>

<p>If you know of any other ways to bind data to UI Controls, please post a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://verysimple.com/2008/09/16/binding-flex-textinput-ui-controls-to-a-dataprovider/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>

