<?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>johnwilker.com &#187; Flex</title>
	<atom:link href="http://johnwilker.com/tag/flex/feed/" rel="self" type="application/rss+xml" />
	<link>http://johnwilker.com</link>
	<description>John Wilker: Community, Code, Randomness</description>
	<lastBuildDate>Wed, 14 Jul 2010 15:33:52 +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>Getting itemRenderer position in an Advanced dataGrid</title>
		<link>http://johnwilker.com/2008/09/getting-itemrenderer-position-in-a-datagrid/</link>
		<comments>http://johnwilker.com/2008/09/getting-itemrenderer-position-in-a-datagrid/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 00:00:00 +0000</pubDate>
		<dc:creator>John Wilker</dc:creator>
				<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[Consulting]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.johnwilker.com/j/index.cfm/2008/6/30/Getting-itemRenderer-position-in-a-dataGrid</guid>
		<description><![CDATA[I was working on a project that required me to replicate MS Access type functionality, in Flex. One of those tasks was clicking into a cell in the datasheet view and knowing what column I selected, so that I could change that column&#8217;s datatype. I also have to know which cell specifically was clicked so [...]]]></description>
			<content:encoded><![CDATA[<p>I was working on a project that required me to replicate MS Access type functionality, in Flex. One of those tasks was clicking into a cell in the datasheet view and knowing what column I selected, so that I could change that column&#8217;s datatype. I also have to know which cell specifically was clicked so that I can pass that data to the rest of the application.</p>
<p>Easier said than done. That is until Jonathan Branam came to my rescue on twitter.</p>
<blockquote><p><span style="color: #339966;">@jwilker <span class="entry-content">listData implement IDropInListItemRenderer &#8211; cast it to AdvancedDataGridListData how much do you need to know?</span></span></p></blockquote>
<p>A little tweaking on my renderer, and what I had been struggling for the better part of a day, was solved, just like that.</p>
<p>My renderer implements IDropInListItemRenderer, and my listData() function translates listData into an adv dataGridListData</p>
<blockquote><p>public function set listData(value:BaseListData):void<br />
{<br />
_listDataGrid = AdvancedDataGridListData(value);</p>
<p>cellText.text = _listDataGrid.label;</p>
<p>cellText.name = &#8220;DataSheet_Grid_Cell_&#8221; + _listDataGrid.columnIndex.toString() + &#8220;_&#8221; + _listDataGrid.rowIndex.toString();<br />
}</p></blockquote>
<p>Then inside my main component, my clickHandler can get the various values i need to do what I need to do (that sounds funny, I know)</p>
<blockquote><p>private function handleClick( evt:MouseEvent ):void<br />
{</p>
<blockquote><p>var tmpColVo:ColumnVO = TableVO(_model.selectedDatabaseVO.selectedObjectVO).acColumns.getItemAt(evt.currentTarget.selectedCells[0].columnIndex) as ColumnVO;<br />
_model.selectedDatabaseVO.dataSheetVO.selectedColumnVO = tmpColVo;<br />
_model.selectedDatabaseVO.dataSheetVO.selectedColumnIndex = evt.currentTarget.selectedCells[0].columnIndex;<br />
_model.selectedDatabaseVO.dataSheetVO.selectedRowIndex = evt.currentTarget.selectedCells[0].rowIndex;<br />
_model.selectedDatabaseVO.dataSheetVO.selectedRowVo = evt.currentTarget.dataProvider.getItemAt(evt.currentTarget.selectedCells[0].rowIndex) as RowVO;</p></blockquote>
</blockquote>
<blockquote><p>var selectionEvent:DataSheetSelectionEvent = new DataSheetSelectionEvent(true);</p>
<p>Access.instance.dispatchEvent(selectionEvent)</p></blockquote>
<blockquote><p>_model.selectedDatabaseVO.dataSheetVO.selectedColumnHeader = TableVO(_model.selectedDatabaseVO.selectedObjectVO).acColumns.getItemAt(evt.currentTarget.selectedCells[0].columnIndex).name;</p>
<p>&#8230;</p>
<p>}</p></blockquote>
<p>The upside was that I was wrapping up my role in the project and was dreading not being able to walk away with no &#8220;I couldn&#8217;t finish&#8221; type things. Which was nice. My renderer is below. It was just a simple POC approach to help another developer with his task, and serve my immediate need, since I had a dependency on that functionality from the renderer.</p>
<p>Props to Jonathan for a solution under 140 characters that saved my day!</p>
]]></content:encoded>
			<wfw:commentRss>http://johnwilker.com/2008/09/getting-itemrenderer-position-in-a-datagrid/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Inverting an Axis on a chart</title>
		<link>http://johnwilker.com/2008/05/inverting-an-axis-on-a-chart/</link>
		<comments>http://johnwilker.com/2008/05/inverting-an-axis-on-a-chart/#comments</comments>
		<pubDate>Tue, 13 May 2008 00:00:00 +0000</pubDate>
		<dc:creator>John Wilker</dc:creator>
				<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[Consulting]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.johnwilker.com/j/index.cfm/2008/6/30/Inverting-an-Axis-on-a-chart</guid>
		<description><![CDATA[I had a case on my latest project where I had a chart that needed to not start at 0,0 as most do. Rather this chart, and the data it represented needed to have it&#8217;s Y Axis inverted. The better numbers were closer to the bottom, and higher in value. 0 was bad. I did [...]]]></description>
			<content:encoded><![CDATA[<p>I had a case on my latest project where I had a chart that needed to not start at 0,0 as most do. Rather this chart, and the data it represented needed to have it&#8217;s Y Axis inverted. The better numbers were closer to the bottom, and higher in value. 0 was bad.</p>
<p>I did some searching and there seemed to be one common approach. manually invert your data. I wasn&#8217;t sure that was what I wanted, but it turned out that that approach worked really well.</p>
<p>in the function that creates the data for the chart, I simply invert the values by subtracting 2* the value, from itself</p>
<blockquote><p><span style="color: #3366ff;">val.perfRank = (performance &#8211; (performance * 2));<br />
val.availRank = (availability &#8211; (availability * 2));<br />
val.consistRank = (consistency &#8211; (consistency * 2));</span></p></blockquote>
<p>After populating my dataprovider with the inverted values, all I needed was a label function to undo my voodoo.</p>
<blockquote><p><span style="color: #3366ff;">private function rankLabelFunction(labelValue:Object, previousLabelValue:Object, axis:IAxis):Number<br />
{<br />
var newAxisValue:Number = Number(labelValue);<br />
newAxisValue = (newAxisValue + (Math.abs(newAxisValue) * 2));<br />
return newAxisValue;<br />
}</span></p></blockquote>
<p>You&#8217;ll want to make sure to do the absolute value, LOL. Otherwise you&#8217;ll be like me, &#8220;Why is the negative number, even bigger? Oh yeah! Duh!&#8221; Math, not my strong suit.</p>
<p>There may be more elegant  ways, I sorta hope there are or will be, but this is a pretty straight forward way to simply put your lowest value at the top of your axis, which is what I needed.</p>
]]></content:encoded>
			<wfw:commentRss>http://johnwilker.com/2008/05/inverting-an-axis-on-a-chart/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Free?!?!?!?!</title>
		<link>http://johnwilker.com/2005/09/free/</link>
		<comments>http://johnwilker.com/2005/09/free/#comments</comments>
		<pubDate>Thu, 08 Sep 2005 00:00:00 +0000</pubDate>
		<dc:creator>John Wilker</dc:creator>
				<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Macromedia]]></category>

		<guid isPermaLink="false">http://www.johnwilker.com/j/index.cfm/2005/6/27/Free?!?!?!?!</guid>
		<description><![CDATA[According to this if you don&#8217;t plan to make any money from it, you can get a license for Flex and Flex Builder. Kinda cool, I hadn&#8217;t heard about it until I read it on another blog. Pretty cool of Macromedia since Flex is so god damn expensive. This gives developers a chance to play [...]]]></description>
			<content:encoded><![CDATA[<p>According to <a href="http://www.macromedia.com/software/flex/productinfo/faq/#ancni" target="_blank">this</a> if you don&#8217;t plan to make any money from it, you can get a license for Flex and Flex Builder. Kinda cool, I hadn&#8217;t heard about it until I read it on another blog. Pretty cool of Macromedia since Flex is so god damn expensive. This gives developers a chance to play with it free of charge. Pretty neat.</p>
]]></content:encoded>
			<wfw:commentRss>http://johnwilker.com/2005/09/free/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
