There has been some debate about whether the migration to Flex 4 is an epic fail or a breeze. As often, the truth is somewhere between. Here is my experience with porting BlocStac.com, an application with roughly 90’000 lines of code including tests, 2 libraries and 8 modules plus 2 Air helper applications.
A good start for the migration is an Adobe article by Joan Lafferty. I also appreciate the information in Adobe’s Wiki. What also helps is that the term “gumbo” works nicely for search. What definitely doesn’t work is searching the Adobe’s forum: you can’t search within the current forum and selecting a single forum in advanced search is impossible due to the sheer number of more than 500 forums.
Skinny CSS, fat Skins
All definitions of borders and paddings in CSS are happily ignored in Flex 4. Using the compiler option “theme=path/halo.swc” is not an option as having components with halo skins and spark skins is not acceptable. What I’ve done so far:
- Move all padding declartions in CSS files into the layout objects of components.
- Write custom skins for all components that require border settings. Because I could not believe that one (after all, it’s quite a lot of work), I asked on the forum. Peter deHaan from Adobe gave a fast and helpful answer. I love this level of support.
- global does not work yet, “*” is also of no help. Still investigating this one.
- Rename “background-color” to “contentBackgroundColor” (does anybody know the reason for this change?)
- Add namespace to CSS
If anything could be called an epic fail, it might be CSS migration. I had to recode pretty much everything defined in CSS and CSS is now pretty sparse. I’m not even sure whether CSS is still worth the concept in Flex 4.
Flex-Mojo, AdvancedDataGrid, etc
Some other issues I hit:
- Flex-mojo: VELO does a great job at bringing maven to the Flex world. It took him only a few hours to include Flex 4beta1 in flex-mojo 3.3-SNAPSHOT and fix an issue with unit testing. Though I hope Adobe offers a maven repository some day… vote for SDK-12730!
- AdvancedDataGrid: TypeError: Error #1007: Instantiation attempted on a non-constructor. at mx.controls::AdvancedDataGridBaseEx/getSeparator()… brought me to Matt Chotin’s answer that it’s not available in Flex 4beta1 (22.214.171.12419). Au contraire, the only Flex4 version that has a working datavisualization library is Flex 4beta1. It comes bundled with Flash Builder beta1 but the library is not compatible anymore with current builds.
Is it worth the pain?
Not yet. Not having AdvancedDataGrid is a show stopper for BlocStac.com. All the work for CSS is unfortunate but it probably leads to better code (though not sure yet). If it brings Flex really forward, it’s fine. After all, I rather see an evolving eco system that let die out obsolete concepts than e.g. the Java language that drags everything along.