<?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>Eric Fickes &#187; actionscript</title>
	<atom:link href="http://ericfickes.com/tag/actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://ericfickes.com</link>
	<description>Independent Contractor for the internet : Adobe and Microsoft technologies</description>
	<lastBuildDate>Wed, 25 Aug 2010 16:53:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Using an AS3 object or class as a DataProvider</title>
		<link>http://ericfickes.com/2010/02/using-an-as3-object-or-class-as-a-dataprovider/</link>
		<comments>http://ericfickes.com/2010/02/using-an-as3-object-or-class-as-a-dataprovider/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 22:25:12 +0000</pubDate>
		<dc:creator>Eric Fickes</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[ArrayCollection]]></category>
		<category><![CDATA[ArrayUtil]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[DataGrid]]></category>
		<category><![CDATA[dataProvider]]></category>
		<category><![CDATA[object]]></category>
		<category><![CDATA[ObjectUtil]]></category>
		<category><![CDATA[reflection]]></category>

		<guid isPermaLink="false">http://ericfickes.com/?p=1120</guid>
		<description><![CDATA[I have a need to use custom class objects as a DataGrid dataprovider.  After wrestling with flash.utils.describeClass() I gave up and found two other methods for binding my custom objects to a DataGrid. First here is a look at the sample MXML app I put together. Click here to run this demo in a new [...]]]></description>
			<content:encoded><![CDATA[<p>I have a need to use custom class objects as a DataGrid dataprovider.  After wrestling with flash.utils.describeClass() I gave up and found two other methods for binding my custom objects to a DataGrid.</p>
<p style="text-align: center;">First here is a look at the <a title="Get the MXML source for this Object as DataGrid.dataProvider sample" href="http://ericfickes.posterous.com/two-methods-for-binding-an-as3-object-to-a-da" target="_blank">sample MXML app I put together</a>.</p>
<div id="attachment_1126" class="wp-caption aligncenter" style="width: 424px"><a href="http://ericfickes.com/wp-content/uploads/2010/02/object-databound-datagrids.png" rel="lightbox[1120]"><img class="size-full wp-image-1126" title="Using custom object as a DataGrid.dataProvider in Flex 3" src="http://ericfickes.com/wp-content/uploads/2010/02/object-databound-datagrids.png" alt="Using custom object as a DataGrid.dataProvider in Flex 3" width="414" height="277" /></a><p class="wp-caption-text">Same object bound two different ways</p></div>
<p style="text-align: center;"><a title="Run this sweet sweet Flex RIA in your own browser" href="http://ericfickes.com/code/flex/reflection/objectAsDataprovider.html" target="_blank">Click here to run this demo in a new window</a>.</p>
<p>In the first grid the DataGrid gets a column per object property.</p>
<pre class="brush: as3;">
var dp_horizontal:Array = ArrayUtil.toArray( myCustomObj );
grid_1.dataProvider = dp_horizontal.valueOf();
</pre>
<p>In the second grid, I run my custom object through a helper function to create an ArrayCollection containing NAME, VALUE pairs for each object property.</p>
<pre class="brush: as3;">
/**
 * Convert a class object into an ArrayCollection to be used
 * as a DataProvider
 */
private function objectToDataProvider( obj:Object ):ArrayCollection
{
	// our DataProvider
	var dp:ArrayCollection = new ArrayCollection();
	// get object class info
	var info:Object = mx.utils.ObjectUtil.getClassInfo( obj );
	// split the class property list into Array
	var propsA:Array = String( info.properties ).split(',');
	// loop over class properties grabbing value and filling up dp
	for( var xx:int = 0; xx &lt;= propsA.length-1; xx++)
	{
		dp.addItem( { name : propsA[ xx ], value : obj[ propsA[ xx ] ] } );
	}

	return dp;
}
</pre>
<p>I&#8217;m currently using this helper function to bind the result of WebORB.NET data calls to a DataGrid for testing.  This code could really be used by any type of object though.</p>
<p>Hope this helps somebody else.</p>
]]></content:encoded>
			<wfw:commentRss>http://ericfickes.com/2010/02/using-an-as3-object-or-class-as-a-dataprovider/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Keyboard doesn&#8217;t release a RadioButtonGroup&#8217;s focus</title>
		<link>http://ericfickes.com/2009/03/keyboard-doesnt-release-a-radiobuttongroups-focus/</link>
		<comments>http://ericfickes.com/2009/03/keyboard-doesnt-release-a-radiobuttongroups-focus/#comments</comments>
		<pubDate>Sat, 07 Mar 2009 03:12:26 +0000</pubDate>
		<dc:creator>Eric Fickes</dc:creator>
				<category><![CDATA[adobe]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[alert]]></category>
		<category><![CDATA[alert.show]]></category>
		<category><![CDATA[keyboard]]></category>
		<category><![CDATA[RadioButtonGroup]]></category>

		<guid isPermaLink="false">http://ericfickes.com/?p=515</guid>
		<description><![CDATA[Today I was using Alert.show() while building a RadioButtonGroup change handler and noticed something interesting. If you use your mouse to change the values of a RadioButtonGroup, Alert.show() will behave like a proper modal dialog. However, if you use your keyboard&#8217;s arrow keys to toggle the values, the focus remains with your RadioButtonGroup. The lesson [...]]]></description>
			<content:encoded><![CDATA[<p>Today I was using Alert.show() while building a RadioButtonGroup change handler and noticed something interesting.<br />
        <br />
        If you use your mouse to change the values of a RadioButtonGroup, Alert.show() will behave like a proper modal dialog.<br />
        However, if you use your keyboard&#8217;s arrow keys to toggle the values, the focus remains with your RadioButtonGroup.</p>
<p>        The lesson here is since the focus remains with my RadioButtonGroup, you can continue to change the values all you want via keyboard.<br />
        In my situation, I kept receiving Alert.show()s, instead of one.</p>
<p>        Try it for yourself.<br />
        First click on a RadioButton below, and notice that the Alert.show() keeps you from clicking on the RadioButtonGroup until you OK the prompt.</p>
<p>        Now try the same thing again using your keyboard.  If you do it enough times, the prompts will cover up the stage completely.</p>
<p>		<iframe src="http://www.ericfickes.com/v1/code/flexRadioButtonAlertShow/alertblur.html" width="251" height="121" scrolling="no" frameborder="0"></iframe></p>
<p>		<a href="http://www.adobe.com/go/EN_US-H-GET-FLASH" target="_bonk" title="Get Adobe Flash Player now!!!!"><br />
        <img src="images/get_adobe_flash_player.png" alt="Get Adobe Flash Player" width="158" height="39" border="0" title="Get the FREE Adobe Flash Player" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://ericfickes.com/2009/03/keyboard-doesnt-release-a-radiobuttongroups-focus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
