Tag Archives: Flex

My Thoughts on Adobe Abandoning Linux

So what.

 

I’m sure there’s lot’s of linux users out there, there’s also probably a lot of Pine users and Mac PPC owners, that doesn’t mean they matter.

Linux folks are used to adversity and being an undervalued minority, so really nothing is changing for them. If they want AIR, let ’em compile their own.

 

Sorry folks, sometimes you have to cut bait and move on.

 

Getting itemRenderer position in an Advanced dataGrid

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’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.

Easier said than done. That is until Jonathan Branam came to my rescue on twitter.

@jwilker listData implement IDropInListItemRenderer – cast it to AdvancedDataGridListData how much do you need to know?

A little tweaking on my renderer, and what I had been struggling for the better part of a day, was solved, just like that.

My renderer implements IDropInListItemRenderer, and my listData() function translates listData into an adv dataGridListData

public function set listData(value:BaseListData):void
{
_listDataGrid = AdvancedDataGridListData(value);

cellText.text = _listDataGrid.label;

cellText.name = “DataSheet_Grid_Cell_” + _listDataGrid.columnIndex.toString() + “_” + _listDataGrid.rowIndex.toString();
}

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)

private function handleClick( evt:MouseEvent ):void
{

var tmpColVo:ColumnVO = TableVO(_model.selectedDatabaseVO.selectedObjectVO).acColumns.getItemAt(evt.currentTarget.selectedCells[0].columnIndex) as ColumnVO;
_model.selectedDatabaseVO.dataSheetVO.selectedColumnVO = tmpColVo;
_model.selectedDatabaseVO.dataSheetVO.selectedColumnIndex = evt.currentTarget.selectedCells[0].columnIndex;
_model.selectedDatabaseVO.dataSheetVO.selectedRowIndex = evt.currentTarget.selectedCells[0].rowIndex;
_model.selectedDatabaseVO.dataSheetVO.selectedRowVo = evt.currentTarget.dataProvider.getItemAt(evt.currentTarget.selectedCells[0].rowIndex) as RowVO;

var selectionEvent:DataSheetSelectionEvent = new DataSheetSelectionEvent(true);

Access.instance.dispatchEvent(selectionEvent)

_model.selectedDatabaseVO.dataSheetVO.selectedColumnHeader = TableVO(_model.selectedDatabaseVO.selectedObjectVO).acColumns.getItemAt(evt.currentTarget.selectedCells[0].columnIndex).name;

}

The upside was that I was wrapping up my role in the project and was dreading not being able to walk away with no “I couldn’t finish” 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.

Props to Jonathan for a solution under 140 characters that saved my day!

Inverting an Axis on a chart

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’s Y Axis inverted. The better numbers were closer to the bottom, and higher in value. 0 was bad.

I did some searching and there seemed to be one common approach. manually invert your data. I wasn’t sure that was what I wanted, but it turned out that that approach worked really well.

in the function that creates the data for the chart, I simply invert the values by subtracting 2* the value, from itself

val.perfRank = (performance – (performance * 2));
val.availRank = (availability – (availability * 2));
val.consistRank = (consistency – (consistency * 2));

After populating my dataprovider with the inverted values, all I needed was a label function to undo my voodoo.

private function rankLabelFunction(labelValue:Object, previousLabelValue:Object, axis:IAxis):Number
{
var newAxisValue:Number = Number(labelValue);
newAxisValue = (newAxisValue + (Math.abs(newAxisValue) * 2));
return newAxisValue;
}

You’ll want to make sure to do the absolute value, LOL. Otherwise you’ll be like me, “Why is the negative number, even bigger? Oh yeah! Duh!” Math, not my strong suit.

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.

Free?!?!?!?!

According to this if you don’t plan to make any money from it, you can get a license for Flex and Flex Builder. Kinda cool, I hadn’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.