Search Flex Samples

Flex 3 and Backwards Compatibility … bugs and how to

After many months of work, we officially released our first public beta of “Moxie” or Flex 3. For myself, on the Flex Framework QA team, one of the biggest things about this the fact that we really are on our way to being open source for the framework. No more secrets… our builds are coming out nightly. You can get them here. And, you can log as many bugs as your heart desires at our Public Bug Base. Really, you can search and see all of our bugs from WAY back. There are definitely bugs older than my life on the team (which is 2004).

Anyways, the thing I wanted to talk about today was some of the backwards compatibility issues you might come upon when you try to upgrade your Application to Flex 3. All of the Compatibility Issues should be written up in the Release Notes, but, I just wanted to highlight a couple of them. First and foremost, you may see some different behaviors with your Button. Specifically, you may notice some Labels that may be truncated. This is NOT a bug. I repeat… its not a bug. In Flex 3, there was a major bug fix to get padding working for a Button. This includes the styles paddingLeft, paddingRight, paddingTop and paddingBottom. Previously, there was a hack in the code and these didn’t really work. Our Button measurement logic had a default of about 10 pixels on its left and right side which was adjusted depending on your label length and whether you had an icon. But, setting padding styles didn’t really work. Now, padding works and the default paddingRight and paddingLeft are 10. Therefore, if you have a button like:

This may render fine in Flex 2.0.1. In Flex 3, the Submit label is truncated. To fix your problem, you can just reset the paddingLeft and paddingRight to smaller values.

If you do not want to go through the trouble of updating your code, Flex 3 comes with a way for you to go back to the old behavior of Flex 2.0.1. If you compile your application with the additional arguments “-compatibility-version=2.0.1″. You won’t getting the Button padding fix and your Application should look exactly the same as before. However, if you do use this compiler argument, there are several other Flex 3 behavior changes that you won’t get. They are all described here. If you want, you can search the Flex SDK code for the inclusion of “FlexVersion”. These are the areas of the code where we have provided various code paths for using old Flex 2.0.1 behavior or the new Flex 3 behavior.

On caveat for using the -compatibility-version compiler argument is that it doesn’t work right now if your Application is using a DataGrid. We found this late in our cycle and therefore didn’t fix it in this beta. So, you will get a runtime error if you use the compatibility flag with a DataGrid (”Bug SDK-11231“).


Related Flex Samples

Learn Flex: Flex Samples | Flex Video Tutorials Flex Examples