Friday, April 9, 2010

Migrating from Flex 4 Beta 2 to Released Flex 4

After having such an easy time migrating from Flex 3.5 to Flex 4 beta 2, and after having several theme related issues mixing Spark/Halo together in beta 2, I decided to migrate to the released version of Flex 4. Painful!

Here is some of what I have found so far.
  1. The mx (halo) namespace switched between the beta and released versions. In Flex 4 beta 2 it is library://ns.adobe.com/flex/halo and in the released version it is library://ns.adobe.com/flex/mx. Still seeing errors? Make sure you have the proper namespaces in your component for fx (Flex), s (Spark), and mx (Halo). See http://www.adobe.com/devnet/flex/articles/flex3and4_differences_03.html for more info.
  2. Flex 4 beta 2 was very kind in allowing all mx styling inline. For example, setting the borderSides property on a VBox works fine. The released version no longer allows that. You must either spark-ify them and use a skin or remove the style. It treats these as errors also, so you have to tackle it. FWIW, we removed all borders across our app and no I have to go fix it all!
  3. All references to the old StyleManager class must be replaced with FlexGlobals.topLevelApplication.styleManager or a separate styleManager instance. This just shows up as a warning, but several libs we use had it everywhere!
  4. This one is the most important because it is hard to debug! If you start seeing errors about not being able to find skins for regular spark classes like Button, Label, Scroller, etc., it is most likely because somewhere in your component hierarchy you have subclasses a spark components and treated the child as a halo component. That does not work. The child of a spark component must also use the fx namespace and the proper mx namespace to run properly. Spent 2 days debugging this problem!
In general I am surprised at how complicated it is to migrate from Flex 4 beta 2 to Flex 4. Why Adobe chose to strip your ability to style old halo components inline makes no sense to me. I know it is now frowned upon, but give me a migration path, not a cliff.

1 comment: